From 07cf229f53ab15bb87b943aa07617681a6088d53 Mon Sep 17 00:00:00 2001 From: David Redondo Date: Thu, 27 Apr 2023 15:22:26 +0200 Subject: Properly clean up screens during reconnect Otherwise the old screens are left dangling. Also create a placeholder screen so the windows get assigned a valid screen upon reconnect. Change-Id: Iea5d1da6f32be5e87464412447ae1449d91d8e75 Reviewed-by: David Edmundson --- src/client/qwaylanddisplay.cpp | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/client/qwaylanddisplay.cpp b/src/client/qwaylanddisplay.cpp index b7e212ab..911004f8 100644 --- a/src/client/qwaylanddisplay.cpp +++ b/src/client/qwaylanddisplay.cpp @@ -420,6 +420,12 @@ void QWaylandDisplay::reconnect() qDeleteAll(mWaitingScreens); mWaitingScreens.clear(); + const auto screens = std::exchange(mScreens, {}); + ensureScreen(); + for (QWaylandScreen *screen : screens) { + QWindowSystemInterface::handleScreenRemoved(screen); + } + // mCompositor mShm.reset(); mCursorThemes.clear(); @@ -449,9 +455,6 @@ void QWaylandDisplay::reconnect() qDeleteAll(std::exchange(mInputDevices, {})); mLastInputDevice = nullptr; - auto screens = mScreens; - mScreens.clear(); - for (const RegistryGlobal &global : mGlobals) { emit globalRemoved(global); } -- cgit v1.2.1