window-actor/wayland: Do not crash when there is no monitor

When all monitors are blanking or after suspending there might not be
any monitors temporarily. We can't draw a black background when we don't
know the size of the monitor it's fullscreen on but it's fine because
there actually is no monitor.

Closes: https://gitlab.gnome.org/GNOME/mutter/-/issues/2508
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2695>
This commit is contained in:
Sebastian Wick 2022-11-15 00:46:14 +01:00
parent e331e38a19
commit d6d6dc65c1

View File

@ -415,11 +415,14 @@ maybe_configure_black_background (MetaWindowActorWayland *self,
float max_height = 0; float max_height = 0;
if (!meta_window_wayland_is_acked_fullscreen (META_WINDOW_WAYLAND (window))) if (!meta_window_wayland_is_acked_fullscreen (META_WINDOW_WAYLAND (window)))
return FALSE; return FALSE;
geometry_scale = meta_window_actor_get_geometry_scale (window_actor); geometry_scale = meta_window_actor_get_geometry_scale (window_actor);
logical_monitor = meta_window_get_main_logical_monitor (window); logical_monitor = meta_window_get_main_logical_monitor (window);
if (!logical_monitor)
return FALSE;
fullscreen_layout = meta_logical_monitor_get_layout (logical_monitor); fullscreen_layout = meta_logical_monitor_get_layout (logical_monitor);
clutter_actor_iter_init (&iter, CLUTTER_ACTOR (self->surface_container)); clutter_actor_iter_init (&iter, CLUTTER_ACTOR (self->surface_container));