From d67ce1e86c0e0300037ab2f6e4863f8a3d51d152 Mon Sep 17 00:00:00 2001 From: David Edmundson Date: Tue, 19 Dec 2017 15:56:06 +0000 Subject: [PATCH] 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 --- .../autotests/client/test_xdg_foreign.cpp | 26 +++++++++---------- 1 file changed, 12 insertions(+), 14 deletions(-) diff --git a/src/wayland/autotests/client/test_xdg_foreign.cpp b/src/wayland/autotests/client/test_xdg_foreign.cpp index 4c28614ba5..f29812f29c 100644 --- a/src/wayland/autotests/client/test_xdg_foreign.cpp +++ b/src/wayland/autotests/client/test_xdg_foreign.cpp @@ -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 }