mirror of
https://gitlab.freedesktop.org/wayland/weston
synced 2024-10-01 20:08:34 +00:00
fullscreen-shell: do not crash when presenting a null surface
The protocol allows presenting a null surface, in this case we would crash. This can be reproduced with weston-fullscreen and pressing 'o'. Signed-off-by: Arnaud Vrac <avrac@freebox.fr>
This commit is contained in:
parent
373ee4df45
commit
238d5274a2
|
@ -131,6 +131,12 @@ replace_default_surface(struct fullscreen_shell *shell, struct weston_surface *s
|
||||||
prev = container_of(shell->default_surface_list.prev,
|
prev = container_of(shell->default_surface_list.prev,
|
||||||
struct fs_client_surface, link);
|
struct fs_client_surface, link);
|
||||||
|
|
||||||
|
if (prev)
|
||||||
|
remove_default_surface(prev);
|
||||||
|
|
||||||
|
if (!surface)
|
||||||
|
return;
|
||||||
|
|
||||||
surf = zalloc(sizeof *surf);
|
surf = zalloc(sizeof *surf);
|
||||||
if (!surf)
|
if (!surf)
|
||||||
return;
|
return;
|
||||||
|
@ -138,9 +144,6 @@ replace_default_surface(struct fullscreen_shell *shell, struct weston_surface *s
|
||||||
surf->surface = surface;
|
surf->surface = surface;
|
||||||
surf->method = method;
|
surf->method = method;
|
||||||
|
|
||||||
if (prev)
|
|
||||||
remove_default_surface(prev);
|
|
||||||
|
|
||||||
wl_list_insert(shell->default_surface_list.prev, &surf->link);
|
wl_list_insert(shell->default_surface_list.prev, &surf->link);
|
||||||
|
|
||||||
surf->surface_destroyed.notify = default_surface_destroy_listener;
|
surf->surface_destroyed.notify = default_surface_destroy_listener;
|
||||||
|
|
Loading…
Reference in a new issue