backends/x11: Fix a crash in KWin::X11WindowedEglPrimaryLayer::present()

CompositorWayland will call the present() function even if the beginFrame()
fails, in which case, m_buffer can be null. Also, the present function
has no code to reset m_buffer after it has finished using it.

SENTRY: KWIN-6JD


(cherry picked from commit 1573657c2d)

Co-authored-by: Vlad Zahorodnii <vlad.zahorodnii@kde.org>
wilder/Plasma/6.2
Vlad Zahorodnii 1 year ago
parent 075154c8c8
commit 445a784ef3
  1. 5
      src/backends/x11/windowed/x11_windowed_egl_backend.cpp

@ -76,6 +76,10 @@ bool X11WindowedEglPrimaryLayer::doEndFrame(const QRegion &renderedRegion, const
void X11WindowedEglPrimaryLayer::present()
{
if (!m_buffer) {
return;
}
xcb_pixmap_t pixmap = m_output->importBuffer(m_buffer->buffer());
Q_ASSERT(pixmap != XCB_PIXMAP_NONE);
@ -105,6 +109,7 @@ void X11WindowedEglPrimaryLayer::present()
EGLNativeFence releaseFence{m_backend->eglDisplayObject()};
m_swapchain->release(m_buffer, releaseFence.fileDescriptor().duplicate());
m_buffer = nullptr;
}
std::shared_ptr<GLTexture> X11WindowedEglPrimaryLayer::texture() const

Loading…
Cancel
Save