desktop-shell: Fix crash when fullscreen surface has no output

The shell_set_view_fullscreen function was dereferencing
shsurf->fullscreen_output without checking if it was NULL first. This
could lead to a crash when a fullscreen surface had no associated
output during display hotplug.

Fix issue: https://gitlab.freedesktop.org/wayland/weston/-/issues/1028

Signed-off-by: liang zhou <liang.zhou@gehealthcare.com>
This commit is contained in:
liang zhou 2025-09-17 14:02:59 +08:00 committed by Marius Vlad
parent 5e7835bf2b
commit 0b540ba8d6

View file

@ -1710,7 +1710,13 @@ shell_set_view_fullscreen(struct shell_surface *shsurf)
struct weston_surface *surface =
weston_desktop_surface_get_surface(shsurf->desktop_surface);
struct weston_compositor *ec = surface->compositor;
struct weston_output *output = shsurf->fullscreen_output->output;
struct weston_output *output = NULL;
if (!shsurf->fullscreen_output)
return;
output = shsurf->fullscreen_output->output;
struct weston_curtain_params curtain_params = {
.r = 0.0, .g = 0.0, .b = 0.0, .a = 1.0,
.pos = output->pos,