x11: Avoid poking MetaCompositor during MetaDisplay destruction
Commit9c3b130f67
changed slightly destruction order to handle use-after-free situations, but missed a small new one introduced by the order change: The MetaX11Display may schedule callbacks through MetaLaters, which depend on the MetaCompositor, which is now freed before the MetaX11Display. Since there is no winning move here, make the MetaX11Display aware of this by avoiding to remove the callback if the MetaCompositor is already gone. The MetaLaters infrastructure is already fully freed at this point (incl. the data it contained), so this shouldn't be a leak. Fixes:9c3b130f67
("display: Fix destruction order") Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3247>
This commit is contained in:
parent
971babfccc
commit
cc874f5d33
@ -1660,9 +1660,14 @@ meta_x11_display_remove_cursor_later (MetaX11Display *x11_display)
|
||||
if (x11_display->reload_x11_cursor_later)
|
||||
{
|
||||
MetaDisplay *display = x11_display->display;
|
||||
MetaLaters *laters = meta_compositor_get_laters (display->compositor);
|
||||
|
||||
meta_laters_remove (laters, x11_display->reload_x11_cursor_later);
|
||||
/* May happen during destruction */
|
||||
if (display->compositor)
|
||||
{
|
||||
MetaLaters *laters = meta_compositor_get_laters (display->compositor);
|
||||
meta_laters_remove (laters, x11_display->reload_x11_cursor_later);
|
||||
}
|
||||
|
||||
x11_display->reload_x11_cursor_later = 0;
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user