autotests: Simplify tearing down ConnectionThread

It should be enough to call QObject::deleteLater() and wait until the
connection thread stops spinning its event loop.
This commit is contained in:
Vlad Zahorodnii 2022-09-08 11:17:36 +03:00
parent 63258ab076
commit e40bdc9016

View file

@ -550,11 +550,7 @@ void destroyWaylandConnection()
delete s_waylandConnection.outputManagementV2; delete s_waylandConnection.outputManagementV2;
s_waylandConnection.outputManagementV2 = nullptr; s_waylandConnection.outputManagementV2 = nullptr;
if (s_waylandConnection.thread) { if (s_waylandConnection.thread) {
QSignalSpy spy(s_waylandConnection.connection, &QObject::destroyed);
s_waylandConnection.connection->deleteLater(); s_waylandConnection.connection->deleteLater();
if (spy.isEmpty()) {
QVERIFY(spy.wait());
}
s_waylandConnection.thread->quit(); s_waylandConnection.thread->quit();
s_waylandConnection.thread->wait(); s_waylandConnection.thread->wait();
delete s_waylandConnection.thread; delete s_waylandConnection.thread;