mtk: Make error traps multi-display

Keep a per-display list of error traps, so we don't mix them
together, and possibly deem unintended error traps outdated.

This means init/deinit calls are now stackable, and need to
happen evenly. In order to honor this, move the MetaX11Display
error trap destrution to finalize.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3230>
This commit is contained in:
Carlos Garnacho
2023-09-01 01:14:21 +02:00
committed by Marge Bot
parent 6f46edd93b
commit ef366c5fcb
2 changed files with 50 additions and 9 deletions

View File

@@ -265,8 +265,6 @@ meta_x11_display_dispose (GObject *object)
x11_display->xroot = None;
}
meta_x11_display_destroy_error_traps (x11_display);
if (x11_display->xdisplay)
{
meta_x11_display_free_events (x11_display);
@@ -288,6 +286,16 @@ meta_x11_display_dispose (GObject *object)
G_OBJECT_CLASS (meta_x11_display_parent_class)->dispose (object);
}
static void
meta_x11_display_finalize (GObject *object)
{
MetaX11Display *x11_display = META_X11_DISPLAY (object);
meta_x11_display_destroy_error_traps (x11_display);
G_OBJECT_CLASS (meta_x11_display_parent_class)->finalize (object);
}
static void
on_x11_display_opened (MetaX11Display *x11_display,
MetaDisplay *display)
@@ -302,6 +310,7 @@ meta_x11_display_class_init (MetaX11DisplayClass *klass)
GObjectClass *object_class = G_OBJECT_CLASS (klass);
object_class->dispose = meta_x11_display_dispose;
object_class->finalize = meta_x11_display_finalize;
}
static void