Destroy all kwayland objects created by registry when it is destroyed
Summary: Currently one has to connect every object manually to connectionDied, which is something we can do for them. If the user also has a connection, the second will just no-op. This fixes objects that linger longer than the QApp. Reviewers: graesslin Reviewed By: graesslin Subscribers: graesslin, plasma-devel, #frameworks Tags: #plasma_on_wayland, #frameworks Differential Revision: https://phabricator.kde.org/D6727
This commit is contained in:
parent
c6b085f5eb
commit
e8ef0ea68f
1 changed files with 15 additions and 2 deletions
|
@ -537,24 +537,37 @@ void TestWaylandRegistry::testDestroy()
|
|||
QVERIFY(connectedSpy.wait());
|
||||
|
||||
Registry registry;
|
||||
QSignalSpy shellAnnouncedSpy(®istry, SIGNAL(shellAnnounced(quint32,quint32)));
|
||||
|
||||
QVERIFY(!registry.isValid());
|
||||
registry.create(connection.display());
|
||||
registry.create(&connection);
|
||||
registry.setup();
|
||||
QVERIFY(registry.isValid());
|
||||
|
||||
connect(&connection, &ConnectionThread::connectionDied, ®istry, &Registry::destroy);
|
||||
//create some arbitrary Interface
|
||||
shellAnnouncedSpy.wait();
|
||||
QScopedPointer<Shell> shell(registry.createShell(registry.interface(Registry::Interface::Shell).name, registry.interface(Registry::Interface::Shell).version, ®istry));
|
||||
|
||||
|
||||
QSignalSpy connectionDiedSpy(&connection, SIGNAL(connectionDied()));
|
||||
QSignalSpy registryDiedSpy(®istry, SIGNAL(registryDestroyed()));
|
||||
|
||||
QVERIFY(connectionDiedSpy.isValid());
|
||||
QVERIFY(registryDiedSpy.isValid());
|
||||
|
||||
delete m_display;
|
||||
m_display = nullptr;
|
||||
QVERIFY(connectionDiedSpy.wait());
|
||||
|
||||
QVERIFY(connectionDiedSpy.count() == 1);
|
||||
QVERIFY(registryDiedSpy.count() == 1);
|
||||
|
||||
// now the registry should be destroyed;
|
||||
QVERIFY(!registry.isValid());
|
||||
|
||||
// calling destroy again should not fail
|
||||
registry.destroy();
|
||||
shell->destroy();
|
||||
}
|
||||
|
||||
void TestWaylandRegistry::testGlobalSync()
|
||||
|
|
Loading…
Reference in a new issue