From 98a1630fa2c3213ad16364bd997f35a59fcf38b7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jonas=20=C3=85dahl?= Date: Fri, 1 Nov 2019 13:18:12 +0100 Subject: [PATCH] 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 | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 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 (window->tile_mode != META_TILE_NONE) + { + if (new) + window->tile_monitor_number = new->number; + else + window->tile_monitor_number = -1; + } + if (new && old) { - if (window->tile_mode != META_TILE_NONE) - window->tile_monitor_number = new->number; - /* 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