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 <aleixpol@kde.org>
Reviewed-by: Vlad Zahorodnii <vlad.zahorodnii@kde.org>
This commit is contained in:
David Edmundson 2024-07-10 09:00:33 +01:00
parent e705040909
commit 9a5054cb62

View File

@ -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());