From: Jonas Ã…dahl Date: Fri, 30 Sep 2022 07:30:30 +0000 (+0200) Subject: surface/wayland: Handle no current monitor when calculating bounds X-Git-Tag: archive/raspbian/4.8.3+ds-2+rpi1~3^2~20^2~1^2~9^2~1 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=79eab08797e1121f0fe7d84f570d28055d3f12b0;p=gtk4.git surface/wayland: Handle no current monitor when calculating bounds We shouldn't assume there is always a monitor to derive bounds from. If there is no monitor, pass empty bounds, as this matches what xdg_toplevel.configure_bounds do in this case. (cherry picked from commit 148c1336745a043a9660da6c4734ed905c628130) --- diff --git a/gdk/wayland/gdksurface-wayland.c b/gdk/wayland/gdksurface-wayland.c index 86392923e5..225d380536 100644 --- a/gdk/wayland/gdksurface-wayland.c +++ b/gdk/wayland/gdksurface-wayland.c @@ -1419,10 +1419,18 @@ configure_toplevel_geometry (GdkSurface *surface) GdkRectangle monitor_geometry; monitor = g_list_model_get_item (gdk_display_get_monitors (display), 0); - gdk_monitor_get_geometry (monitor, &monitor_geometry); - bounds_width = monitor_geometry.width; - bounds_height = monitor_geometry.height; - g_object_unref (monitor); + if (monitor) + { + gdk_monitor_get_geometry (monitor, &monitor_geometry); + bounds_width = monitor_geometry.width; + bounds_height = monitor_geometry.height; + g_object_unref (monitor); + } + else + { + bounds_width = 0; + bounds_height = 0; + } } gdk_toplevel_size_init (&size, bounds_width, bounds_height);