From 02cebe93a67bb6781e4642344a9a566ab94a1326 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Gr=C3=A4=C3=9Flin?= Date: Fri, 12 Jun 2015 16:22:41 +0200 Subject: [PATCH] [wayland] Unreference the buffer when destroying the WindowPixmap When we don't use the buffer anymore, we should discard it. Otherwise we start to leak buffers and that can result in clients dead locking while waiting for more free buffers. --- scene.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/scene.cpp b/scene.cpp index 6a6714272f..09b7ec4a3d 100644 --- a/scene.cpp +++ b/scene.cpp @@ -937,6 +937,13 @@ WindowPixmap::~WindowPixmap() if (isValid() && !kwinApp()->shouldUseWaylandForCompositing()) { xcb_free_pixmap(connection(), m_pixmap); } +#if HAVE_WAYLAND + if (m_buffer) { + using namespace KWayland::Server; + QObject::disconnect(m_buffer.data(), &BufferInterface::aboutToBeDestroyed, m_buffer.data(), &BufferInterface::unref); + m_buffer->unref(); + } +#endif } void WindowPixmap::create()