backends/drm: Fix a crash in DrmGpu::releaseBuffers()
Currently, the code assumes that the primary and the cursor layers are always present. However, it's not guaranteed if the render backend cannot be recreated. Specifically: - the Compositor destroys the EglGbmBackend. The egl gbm backend, in its turn, resets the primary and the cursor layers to null - the Compositor tries to create the EglGbmBackend but that fails so it is destroyed. EglGbmBackend::~EglGbmBackend() calls DrmGpu::releaseBuffers(), but it hits an unexpected null primary layer. Normally, the primary and the cursor layers would be created when the Compositor successfully creates the WorkspaceScene. Since the RenderBackend fails to initialize, the WorkspaceScene is not created and the DrmGpu doesn't recreate the layers.
This commit is contained in:
parent
59699402ad
commit
2ec45f33d1
1 changed files with 6 additions and 2 deletions
|
@ -806,8 +806,12 @@ void DrmGpu::releaseBuffers()
|
|||
crtc->releaseCurrentBuffer();
|
||||
}
|
||||
for (const auto &pipeline : std::as_const(m_pipelines)) {
|
||||
pipeline->primaryLayer()->releaseBuffers();
|
||||
pipeline->cursorLayer()->releaseBuffers();
|
||||
if (DrmPipelineLayer *layer = pipeline->primaryLayer()) {
|
||||
layer->releaseBuffers();
|
||||
}
|
||||
if (DrmPipelineLayer *layer = pipeline->cursorLayer()) {
|
||||
layer->releaseBuffers();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue