From 8811c62a0c31443ee888a67df2e960bc040f3dcc Mon Sep 17 00:00:00 2001 From: David Edmundson Date: Wed, 10 Jul 2024 09:00:33 +0100 Subject: [PATCH 1/2] client: Guard against windows being on a null screen calculateScreenFromSurfaceEvents uses the screen information from our surface enter events. If this is not set yet, or refers to outputs not yet complete we fall back to the QWindow::screen. This was introduced in e03613524fc9f6be5c4cd7e9bdb00bc09c7f1e0b. It was assumed that this would always be a valid value as QtBase keeps it updated, but there are apparently paths for it to still be null. It will be evaluated again when the surface receives a wl_enter event or the output that we have entered is finally initialised and we will then be marked as on the correct screen. Change-Id: I33b4a5112c3426a8ea523d39a0658ba7ffee5298 Reviewed-by: Aleix Pol Gonzalez Reviewed-by: Vlad Zahorodnii (cherry picked from commit c4f91b479303dda2e49499de249018d7c66c5f99) Reviewed-by: Qt Cherry-pick Bot (cherry picked from commit ec07c90cd647fd7a647f3f10dcae4d18699263df) (cherry picked from commit 406995207eae8d644b6e5262aa716a48c7e471a8) --- src/client/qwaylandwindow.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/client/qwaylandwindow.cpp b/src/client/qwaylandwindow.cpp index 22aeba10..c64f3326 100644 --- a/src/client/qwaylandwindow.cpp +++ b/src/client/qwaylandwindow.cpp @@ -1405,7 +1405,7 @@ void QWaylandWindow::handleScreensChanged() { QPlatformScreen *newScreen = calculateScreenFromSurfaceEvents(); - if (newScreen->screen() == window()->screen()) + if (!newScreen || newScreen->screen() == window()->screen()) return; QWindowSystemInterface::handleWindowScreenChanged(window(), newScreen->QPlatformScreen::screen()); -- 2.45.2