Figure out nested wayland dismantle

Summary:
Fixes a crash we would get, we're changing 2 main things:
- release the event queue first, otherwise we'd serve events to
disappearing objects.
- destroy the connection thread object after the thread has quit.

Test Plan: KWin doesn't explode when closing.

Reviewers: #kwin, davidedmundson

Reviewed By: #kwin, davidedmundson

Subscribers: davidedmundson, kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D28340
This commit is contained in:
Aleix Pol 2020-03-27 14:18:22 +01:00
parent 5498ed9565
commit 7db9129521

View file

@ -463,6 +463,7 @@ WaylandBackend::~WaylandBackend()
}
delete m_waylandCursor;
m_eventQueue->release();
qDeleteAll(m_outputs);
if (m_xdgShell) {
@ -473,11 +474,10 @@ WaylandBackend::~WaylandBackend()
m_registry->release();
delete m_seat;
m_shm->release();
m_eventQueue->release();
m_connectionThreadObject->deleteLater();
m_connectionThread->quit();
m_connectionThread->wait();
m_connectionThreadObject->deleteLater();
qCDebug(KWIN_WAYLAND_BACKEND) << "Destroyed Wayland display";
}