From 9a5054cb624b4a8471bfbcb2f3f5e510f0eb1355 Mon Sep 17 00:00:00 2001 From: David Edmundson Date: Wed, 10 Jul 2024 09:00:33 +0100 Subject: [PATCH] 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 2f7a86fac338dc78259d93b675f1cd131c24c926. 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. Pick-to: 6.8 Pick-to: 6.7 Change-Id: I33b4a5112c3426a8ea523d39a0658ba7ffee5298 Reviewed-by: Aleix Pol Gonzalez Reviewed-by: Vlad Zahorodnii --- src/plugins/platforms/wayland/qwaylandwindow.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/plugins/platforms/wayland/qwaylandwindow.cpp b/src/plugins/platforms/wayland/qwaylandwindow.cpp index 3aea7bbb35d..774de413f62 100644 --- a/src/plugins/platforms/wayland/qwaylandwindow.cpp +++ b/src/plugins/platforms/wayland/qwaylandwindow.cpp @@ -1424,7 +1424,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());