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
This commit is contained in:
Martin Gräßlin 2016-05-12 07:56:46 +02:00
parent 4f222c2cda
commit 0be773262e

View file

@ -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