[mutter/gnome-3-34] window: Always update tile monitor number on hot plug



commit 98a1630fa2c3213ad16364bd997f35a59fcf38b7
Author: Jonas Ã…dahl <jadahl gmail com>
Date:   Fri Nov 1 13:18:12 2019 +0100

    window: Always update tile monitor number on hot plug
    
    Otherwise we'll end up crashing if we had two connected monitors,
    unplugged both, then replugged in a single one.
    
    Avoids the following error:
    
        #0  _g_log_abort ()
        #1  g_logv ()
        #2  g_log ()
        #3  meta_monitor_manager_get_logical_monitor_from_number ()
        #4  meta_window_get_work_area_for_monitor ()
        #5  meta_window_get_tile_area ()
        #6  constrain_maximization ()
        #7  do_all_constraints ()
        #8  meta_window_constrain ()
        #9  meta_window_move_resize_internal ()
        #10 meta_window_move_resize_frame ()
        #11 meta_window_move_resize_now ()
        #12 idle_move_resize ()
        #13 call_idle_later ()
    
    https://bugzilla.redhat.com/show_bug.cgi?id=1767703
    
    https://gitlab.gnome.org/GNOME/mutter/merge_requests/912

 src/core/window.c | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)
---
diff --git a/src/core/window.c b/src/core/window.c
index e276b1e59..f72260f5d 100644
--- a/src/core/window.c
+++ b/src/core/window.c
@@ -3923,11 +3923,16 @@ meta_window_update_for_monitors_changed (MetaWindow *window)
   if (!new)
     new = meta_monitor_manager_get_primary_logical_monitor (monitor_manager);
 
-  if (new && old)
+  if (window->tile_mode != META_TILE_NONE)
     {
-      if (window->tile_mode != META_TILE_NONE)
+      if (new)
         window->tile_monitor_number = new->number;
+      else
+        window->tile_monitor_number = -1;
+    }
 
+  if (new && old)
+    {
       /* This will eventually reach meta_window_update_monitor that
        * will send leave/enter-monitor events. The old != new monitor
        * check will always fail (due to the new logical_monitors set) so


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]