Commit 5328a253 authored by Martin Flöser's avatar Martin Flöser

[kstyle] Change ownership of Wayland objects so that KWin can delete them

Summary:
KWin has a problem that breeze crashes it on tear down if the shadow was
created. This is due to breeze destroying the Wayland connection after
KWin destroyed it which triggers a crash in libwayland.

D6571 addresses this problem by deleting the ConnectionThread created by
plugins prior to destroying the Wayland server.

By changing the ownership of the registry and the interfaces to be
children and grandchildren of the ConnectionThread we can ensure that
KWin can clean up this area properly. For non KWin cases this doesn't
change anything, everything is still deleted as a child of ShadowHelper.

Test Plan: Ensured that the Registry gets deleted before KWin's own connection

Reviewers: #kwin, #plasma

Subscribers: plasma-devel

Tags: #plasma

Differential Revision: https://phabricator.kde.org/D6572
parent 69069193
......@@ -90,17 +90,17 @@ namespace Breeze
if( !connection ) {
return;
}
auto registry = new Registry( this );
auto registry = new Registry( connection );
registry->create( connection );
connect(registry, &Registry::interfacesAnnounced, this,
[registry, this] {
const auto interface = registry->interface( Registry::Interface::Shadow );
if( interface.name != 0 ) {
_shadowManager = registry->createShadowManager( interface.name, interface.version, this );
_shadowManager = registry->createShadowManager( interface.name, interface.version, registry );
}
const auto shmInterface = registry->interface( Registry::Interface::Shm );
if( shmInterface.name != 0 ) {
_shmPool = registry->createShmPool( shmInterface.name, shmInterface.version, this );
_shmPool = registry->createShmPool( shmInterface.name, shmInterface.version, registry );
}
}
);
......
......@@ -24,6 +24,7 @@
#include "config-breeze.h"
#include <QObject>
#include <QPointer>
#include <QMap>
#include <QMargins>
......@@ -183,10 +184,10 @@ namespace Breeze
QMap<QWidget*, KWayland::Client::Surface *> _widgetSurfaces;
//* The Wayland shadow manager to create Shadows for Surfaces (QWindow)
KWayland::Client::ShadowManager* _shadowManager;
QPointer<KWayland::Client::ShadowManager> _shadowManager;
//* The Wayland Shared memory pool to share the shadow pixmaps with compositor
KWayland::Client::ShmPool* _shmPool;
QPointer<KWayland::Client::ShmPool> _shmPool;
#endif
};
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment