From 148c1336745a043a9660da6c4734ed905c628130 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Jonas=20=C3=85dahl?= Date: Fri, 30 Sep 2022 09:30:30 +0200 Subject: [PATCH] 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. --- gdk/wayland/gdksurface-wayland.c | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) 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); -- 2.30.2