Emit connectionDied on all Wayland connections of plugins on teardown

Summary:
Some libraries loaded into KWin (e.g. breeze) also have a Wayland
connection. If KWin destroyes it's own Wayland connection before the
libraries destroy theirs, KWin might crash on tear down when the
libraries call into libwayland with an invalid connection.

This change requires D6569 in KWayland.

Reviewers: #kwin, #plasma

Subscribers: plasma-devel, kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D6571
This commit is contained in:
Martin Flöser 2017-07-08 15:21:16 +02:00
parent 777f7009ed
commit 06433997e8

View file

@ -90,6 +90,15 @@ void WaylandServer::destroyInternalConnection()
{
emit terminatingInternalClientConnection();
if (m_internalConnection.client) {
// delete all connections hold by plugins like e.g. widget style
const auto connections = KWayland::Client::ConnectionThread::connections();
for (auto c : connections) {
if (c == m_internalConnection.client) {
continue;
}
emit c->connectionDied();
}
delete m_internalConnection.registry;
delete m_internalConnection.shm;
dispatch();