mirror of
https://github.com/brl/mutter.git
synced 2024-12-25 20:32:16 +00:00
x11/x11-errors: Use the default error handler when display is destroyed
An X11 server connection may still be around when we close the display, and mutter_x_error could be triggered when x11_display has been already destroyed leading to a crash. To prevent this use the default X11 error handler. As per this, also move the ownership of the error traps to x11-errors. See: https://gitlab.gnome.org/GNOME/mutter/-/issues/2835 Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3020>
This commit is contained in:
parent
6d992e9e45
commit
889cd056e7
@ -299,4 +299,6 @@ void meta_x11_display_clear_stage_input_region (MetaX11Display *x11_display);
|
||||
|
||||
void meta_x11_display_init_error_traps (MetaX11Display *x11_display);
|
||||
|
||||
void meta_x11_display_destroy_error_traps (MetaX11Display *x11_display);
|
||||
|
||||
#endif /* META_X11_DISPLAY_PRIVATE_H */
|
||||
|
@ -265,6 +265,7 @@ meta_x11_display_dispose (GObject *object)
|
||||
x11_display->xroot = None;
|
||||
}
|
||||
|
||||
meta_x11_display_destroy_error_traps (x11_display);
|
||||
|
||||
if (x11_display->xdisplay)
|
||||
{
|
||||
@ -284,8 +285,6 @@ meta_x11_display_dispose (GObject *object)
|
||||
g_free (x11_display->screen_name);
|
||||
x11_display->screen_name = NULL;
|
||||
|
||||
g_clear_list (&x11_display->error_traps, g_free);
|
||||
|
||||
G_OBJECT_CLASS (meta_x11_display_parent_class)->dispose (object);
|
||||
}
|
||||
|
||||
|
@ -205,10 +205,23 @@ delete_outdated_error_traps (MetaX11Display *x11_display)
|
||||
void
|
||||
meta_x11_display_init_error_traps (MetaX11Display *x11_display)
|
||||
{
|
||||
g_assert (error_x11_display == NULL);
|
||||
error_x11_display = x11_display;
|
||||
XSetErrorHandler (meta_x_error);
|
||||
}
|
||||
|
||||
void
|
||||
meta_x11_display_destroy_error_traps (MetaX11Display *x11_display)
|
||||
{
|
||||
if (error_x11_display == NULL)
|
||||
return;
|
||||
|
||||
g_assert (error_x11_display == x11_display);
|
||||
g_clear_list (&x11_display->error_traps, g_free);
|
||||
error_x11_display = NULL;
|
||||
XSetErrorHandler (NULL);
|
||||
}
|
||||
|
||||
void
|
||||
meta_x11_error_trap_push (MetaX11Display *x11_display)
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user