Fix ASAN warning on TestXdgForeign

Summary:
Internally XdgForeign has some delete laters

If we clean up the connection immediately we delete them after we kill
the connection resulting in an error.

Kwin isn't going to tear down the connection in response to a resource
unbinding so we can just fix the test.

Test Plan:
Compiled with ASAN
Got further

Reviewers: #plasma, graesslin

Reviewed By: #plasma, graesslin

Subscribers: plasma-devel, #frameworks

Tags: #frameworks, #plasma

Differential Revision: https://phabricator.kde.org/D9406
This commit is contained in:
David Edmundson 2017-12-19 15:56:06 +00:00
parent 9251e894e4
commit d67ce1e86c

View file

@ -165,20 +165,9 @@ void TestForeign::cleanup()
variable = nullptr; \
}
//some tests delete it beforehand
if (m_exportedSurfaceInterface) {
QSignalSpy exportedSurfaceDestroyedSpy(m_exportedSurfaceInterface.data(), &QObject::destroyed);
QVERIFY(exportedSurfaceDestroyedSpy.isValid());
CLEANUP(m_exportedSurface)
exportedSurfaceDestroyedSpy.wait();
}
CLEANUP(m_exportedSurfaceInterface)
CLEANUP(m_childSurfaceInterface)
if (m_childSurfaceInterface) {
QSignalSpy childSurfaceDestroyedSpy(m_childSurfaceInterface.data(), &QObject::destroyed);
QVERIFY(childSurfaceDestroyedSpy.isValid());
CLEANUP(m_childSurface)
childSurfaceDestroyedSpy.wait();
}
CLEANUP(m_compositor)
@ -197,7 +186,16 @@ void TestForeign::cleanup()
}
CLEANUP(m_compositorInterface)
CLEANUP(m_foreignInterface)
CLEANUP(m_display)
//internally there are some deleteLaters on exported interfaces
//we want them processed before we delete the connection
if (m_display) {
QSignalSpy destroyedSpy(m_display, &QObject::destroyed);
m_display->deleteLater();
m_display = nullptr;
destroyedSpy.wait();
}
#undef CLEANUP
}