window: Handle updating from no to no monitor

When we received two hot plug events that both resulted in headless
configuration, we tried to find a new window monitor given the old.
That resulted in a null pointer dereference; avoid that by only trying
to find the same monitor if there was an old one.

https://bugzilla.gnome.org/show_bug.cgi?id=788607
This commit is contained in:
Jonas Ådahl 2017-10-07 00:33:39 -04:00
parent 7928b25ebf
commit 6eb7d13894

View File

@ -3793,7 +3793,7 @@ meta_window_update_for_monitors_changed (MetaWindow *window)
new = find_monitor_by_winsys_id (window, window->preferred_output_winsys_id);
/* Otherwise, try to find the old output on a new monitor */
if (!new)
if (old && !new)
new = find_monitor_by_winsys_id (window, old->winsys_id);
/* Fall back to primary if everything else failed */