diff --git a/src/backends/drm/egl_gbm_layer_surface.cpp b/src/backends/drm/egl_gbm_layer_surface.cpp index c02121def4..a9c08c4cc3 100644 --- a/src/backends/drm/egl_gbm_layer_surface.cpp +++ b/src/backends/drm/egl_gbm_layer_surface.cpp @@ -123,12 +123,13 @@ std::optional, QRegion>> EglGbmLayerS } GLFramebuffer::popFramebuffer(); if (m_gpu == m_eglBackend->gpu()) { - const auto buffer = m_gbmSurface->swapBuffers(damagedRegion); - if (buffer) { + if (const auto buffer = m_gbmSurface->swapBuffers(damagedRegion)) { + m_currentBuffer = buffer; return std::tuple(DrmFramebuffer::createFramebuffer(buffer), damagedRegion); } } else { - if (m_gbmSurface->swapBuffers(damagedRegion)) { + if (const auto gbmBuffer = m_gbmSurface->swapBuffers(damagedRegion)) { + m_currentBuffer = gbmBuffer; const auto buffer = importBuffer(); if (buffer) { return std::tuple(buffer, damagedRegion);