Blob Blame History Raw
From 07e5f7ef29b5567e090221d5da9415e8b84c0ebb Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Jonas=20=C3=85dahl?= <jadahl@gmail.com>
Date: Mon, 16 Oct 2017 17:02:51 +0800
Subject: [PATCH 3/4] window/wayland: Handle resizing when headless

We tried to get the geometry scale, which may depend on the main
logical monitor assigned to the window. To avoid dereferencing a NULL
logical monitor when headless, instead assume the geometry scale is 1.

https://bugzilla.gnome.org/show_bug.cgi?id=788764
---
 src/wayland/meta-window-wayland.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/src/wayland/meta-window-wayland.c b/src/wayland/meta-window-wayland.c
index ed6e34b43..f3f0e1688 100644
--- a/src/wayland/meta-window-wayland.c
+++ b/src/wayland/meta-window-wayland.c
@@ -67,6 +67,8 @@ G_DEFINE_TYPE (MetaWindowWayland, meta_window_wayland, META_TYPE_WINDOW)
 static int
 get_window_geometry_scale_for_logical_monitor (MetaLogicalMonitor *logical_monitor)
 {
+  g_assert (logical_monitor);
+
   if (meta_is_stage_views_scaled ())
     return 1;
   else
@@ -79,8 +81,7 @@ meta_window_wayland_manage (MetaWindow *window)
   MetaWindowWayland *wl_window = META_WINDOW_WAYLAND (window);
   MetaDisplay *display = window->display;
 
-  wl_window->geometry_scale =
-    get_window_geometry_scale_for_logical_monitor (window->monitor);
+  wl_window->geometry_scale = meta_window_wayland_get_geometry_scale (window);
 
   meta_display_register_wayland_window (display, window);
 
@@ -634,6 +635,9 @@ should_do_pending_move (MetaWindowWayland *wl_window,
 int
 meta_window_wayland_get_geometry_scale (MetaWindow *window)
 {
+  if (!window->monitor)
+    return 1;
+
   return get_window_geometry_scale_for_logical_monitor (window->monitor);
 }
 
-- 
2.14.2