gbm: guard for drm renderer being present before clearing

ref #56
This commit is contained in:
Vaxry 2024-08-19 18:26:21 +02:00
parent 71da3e00a0
commit 696a5ad4ec
3 changed files with 4 additions and 3 deletions

View file

@ -378,7 +378,7 @@ namespace Aquamarine {
struct {
Hyprutils::Memory::CSharedPointer<IAllocator> allocator;
Hyprutils::Memory::CSharedPointer<CDRMRenderer> renderer;
Hyprutils::Memory::CSharedPointer<CDRMRenderer> renderer; // may be null if creation fails
} rendererState;
Hyprutils::Memory::CWeakPointer<CBackend> backend;

View file

@ -192,6 +192,7 @@ Aquamarine::CGBMBuffer::CGBMBuffer(const SAllocatorBufferParams& params, Hypruti
if (params.scanout && swapchain->backendImpl->type() == AQ_BACKEND_DRM) {
// clear the buffer using the DRM renderer to avoid uninitialized mem
auto impl = (CDRMBackend*)swapchain->backendImpl.get();
if (impl->rendererState.renderer)
impl->rendererState.renderer->clearBuffer(this);
}
}