Commit e8ef0ea6 authored by David Edmundson's avatar David Edmundson
Browse files

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
parent c6b085f5
......@@ -537,24 +537,37 @@ void TestWaylandRegistry::testDestroy()
QVERIFY(connectedSpy.wait());
Registry registry;
QSignalSpy shellAnnouncedSpy(&registry, SIGNAL(shellAnnounced(quint32,quint32)));
QVERIFY(!registry.isValid());
registry.create(connection.display());
registry.create(&connection);
registry.setup();
QVERIFY(registry.isValid());
connect(&connection, &ConnectionThread::connectionDied, &registry, &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, &registry));
QSignalSpy connectionDiedSpy(&connection, SIGNAL(connectionDied()));
QSignalSpy registryDiedSpy(&registry, 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()
......
Supports Markdown
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