From 0be773262e011b9c6afa36410be6e7af75fdf593 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Gr=C3=A4=C3=9Flin?= Date: Thu, 12 May 2016 07:56:46 +0200 Subject: [PATCH] Unmap PlasmaWindowInterface instead of deleting directly Summary: The window will be cleaned up automatically once all bound resources are destroyed. A manual delete though might cause protocol errors on client side as the unmap and resource destroy happen together and we are in a race condition. To ensure that we don't leak the interface is set as the parent, so on tear-down remaining resources will be destroyed eventually, even if it triggers a protocol error on the client. Reviewers: #plasma Subscribers: plasma-devel Projects: #plasma Differential Revision: https://phabricator.kde.org/D1595 --- abstract_client.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/abstract_client.cpp b/abstract_client.cpp index 87b70f87e9..c477b06a31 100644 --- a/abstract_client.cpp +++ b/abstract_client.cpp @@ -630,7 +630,7 @@ void AbstractClient::setupWindowManagementInterface() return; } using namespace KWayland::Server; - auto w = waylandServer()->windowManagement()->createWindow(this); + auto w = waylandServer()->windowManagement()->createWindow(waylandServer()->windowManagement()); w->setTitle(caption()); w->setVirtualDesktop(isOnAllDesktops() ? 0 : desktop() - 1); w->setActive(isActive()); @@ -762,8 +762,10 @@ void AbstractClient::setupWindowManagementInterface() void AbstractClient::destroyWindowManagementInterface() { - delete m_windowManagementInterface; - m_windowManagementInterface = nullptr; + if (m_windowManagementInterface) { + m_windowManagementInterface->unmap(); + m_windowManagementInterface = nullptr; + } } Options::MouseCommand AbstractClient::getMouseCommand(Qt::MouseButton button, bool *handled) const