mirror of
https://github.com/brl/mutter.git
synced 2024-11-30 03:50:47 -05:00
window/wayland: Always update the monitor when updating
If the window didn't have a size, it would still have a monitor, and when we are asked to update, we must update, as the old monitor might not be kept around, leaving us vulnerable to use after free. Avoid not updating the monitor by using the stored IDs (preferred, or previous) to find suitable logical monitors, with the primary monitor being the last fallback unless we're completely headless. This fixes the assert !window->monitor || g_list_find (meta_monitor_manager_get_logical_monitors (monitor_manager), window->monitor) in meta_window_update_for_monitors_changed() being hit when a Wayland window has been created, but not mapped, when a hotplug happens. Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2554>
This commit is contained in:
parent
4ed9653757
commit
5f96194e9e
@ -490,7 +490,10 @@ meta_window_wayland_update_main_monitor (MetaWindow *window,
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (window->rect.width == 0 || window->rect.height == 0)
|
if (window->rect.width == 0 || window->rect.height == 0)
|
||||||
|
{
|
||||||
|
window->monitor = meta_window_find_monitor_from_id (window);
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
/* Require both the current and the new monitor would be the new main monitor,
|
/* Require both the current and the new monitor would be the new main monitor,
|
||||||
* even given the resulting scale the window would end up having. This is
|
* even given the resulting scale the window would end up having. This is
|
||||||
|
Loading…
Reference in New Issue
Block a user