Commit 69d23935 authored by David Edmundson's avatar David Edmundson Committed by Vlad Zahorodnii
Browse files

[autotests] Keep registry on the stack

Parenting both registry and the client connection to the test leads to a
confusing teardown order. Especially as m_connection is explicitly
deleted in cleanup()

Scoping registry to where it's actually used solves that
parent ad602ced
...@@ -186,26 +186,25 @@ void DataControlInterfaceTest::init() ...@@ -186,26 +186,25 @@ void DataControlInterfaceTest::init()
m_queue->setup(m_connection); m_queue->setup(m_connection);
QVERIFY(m_queue->isValid()); QVERIFY(m_queue->isValid());
auto registry = new KWayland::Client::Registry(this); KWayland::Client::Registry registry;
connect(registry, &KWayland::Client::Registry::interfaceAnnounced, this, [this, registry](const QByteArray &interface, quint32 name, quint32 version) { connect(&registry, &KWayland::Client::Registry::interfaceAnnounced, this, [this, &registry](const QByteArray &interface, quint32 name, quint32 version) {
if (interface == "zwlr_data_control_manager_v1") { if (interface == "zwlr_data_control_manager_v1") {
m_dataControlDeviceManager = new DataControlDeviceManager; m_dataControlDeviceManager = new DataControlDeviceManager;
m_dataControlDeviceManager->init(registry->registry(), name, version); m_dataControlDeviceManager->init(registry.registry(), name, version);
m_dataControlDeviceManager->setParent(registry);
} }
}); });
connect(registry, &KWayland::Client::Registry::seatAnnounced, this, [this, registry](quint32 name, quint32 version) { connect(&registry, &KWayland::Client::Registry::seatAnnounced, this, [this, &registry](quint32 name, quint32 version) {
m_clientSeat = registry->createSeat(name, version); m_clientSeat = registry.createSeat(name, version);
}); });
registry->setEventQueue(m_queue); registry.setEventQueue(m_queue);
QSignalSpy compositorSpy(registry, &KWayland::Client::Registry::compositorAnnounced); QSignalSpy compositorSpy(&registry, &KWayland::Client::Registry::compositorAnnounced);
registry->create(m_connection->display()); registry.create(m_connection->display());
QVERIFY(registry->isValid()); QVERIFY(registry.isValid());
registry->setup(); registry.setup();
wl_display_flush(m_connection->display()); wl_display_flush(m_connection->display());
QVERIFY(compositorSpy.wait()); QVERIFY(compositorSpy.wait());
m_clientCompositor = registry->createCompositor(compositorSpy.first().first().value<quint32>(), compositorSpy.first().last().value<quint32>(), this); m_clientCompositor = registry.createCompositor(compositorSpy.first().first().value<quint32>(), compositorSpy.first().last().value<quint32>(), this);
QVERIFY(m_clientCompositor->isValid()); QVERIFY(m_clientCompositor->isValid());
QVERIFY(m_dataControlDeviceManager); QVERIFY(m_dataControlDeviceManager);
......
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