diff --git a/src/wayland/autotests/client/test_wayland_windowmanagement.cpp b/src/wayland/autotests/client/test_wayland_windowmanagement.cpp index ccaada0eaa..6488932277 100644 --- a/src/wayland/autotests/client/test_wayland_windowmanagement.cpp +++ b/src/wayland/autotests/client/test_wayland_windowmanagement.cpp @@ -206,12 +206,14 @@ void TestWindowManagement::cleanup() m_registry = nullptr; } if (m_thread) { + if (m_connection) { + m_connection->deleteLater(); + } m_thread->quit(); m_thread->wait(); delete m_thread; m_thread = nullptr; } - delete m_connection; m_connection = nullptr; delete m_display;