1
0
Fork 0

window: Assert we have an up to date monitor after they changed

Add an assert that we don't have a MetaWindow::monitor pointer that
points to an old MetaLogicalMonitor. After this, and the other
monitors-changed callbacks have been called, the old MetaLogicalMonitor
will be destoryed, thus if we didn't update the pointer here, we'll
point to freed memory, and will eventually crash later on.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/929
This commit is contained in:
Jonas Ådahl 2019-11-11 11:01:43 +01:00 committed by Georges Basile Stavracas Neto
parent 5582d7b3be
commit 4af4b79123

View file

@ -3915,7 +3915,7 @@ meta_window_update_for_monitors_changed (MetaWindow *window)
{
meta_window_update_monitor (window,
META_WINDOW_UPDATE_MONITOR_FLAGS_FORCE);
return;
goto out;
}
old = window->monitor;
@ -3958,6 +3958,11 @@ meta_window_update_for_monitors_changed (MetaWindow *window)
meta_window_update_monitor (window,
META_WINDOW_UPDATE_MONITOR_FLAGS_FORCE);
}
out:
g_assert (!window->monitor ||
g_list_find (meta_monitor_manager_get_logical_monitors (monitor_manager),
window->monitor));
}
void