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
This commit is contained in:
Jonas Ådahl 2019-11-01 13:18:12 +01:00
parent dc1a28c42a
commit 77aad0869f

View File

@ -3932,11 +3932,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