backends/native: Add missing seat finalization paths

On finalize we leak the clutter backend, which leaks the stage and seat.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1403>
This commit is contained in:
Carlos Garnacho 2020-11-21 14:05:08 +01:00 committed by Marge Bot
parent 424f3b702e
commit 321b971a96
2 changed files with 16 additions and 0 deletions

View File

@ -231,6 +231,8 @@ meta_backend_finalize (GObject *object)
g_clear_object (&priv->profiler); g_clear_object (&priv->profiler);
#endif #endif
g_clear_object (&priv->clutter_backend);
G_OBJECT_CLASS (meta_backend_parent_class)->finalize (object); G_OBJECT_CLASS (meta_backend_parent_class)->finalize (object);
} }

View File

@ -125,6 +125,17 @@ meta_clutter_backend_native_is_display_server (ClutterBackend *backend)
return TRUE; return TRUE;
} }
static void
meta_clutter_backend_native_finalize (GObject *object)
{
MetaClutterBackendNative *backend_native = META_CLUTTER_BACKEND_NATIVE (object);
g_clear_object (&backend_native->main_seat);
g_clear_object (&backend_native->stage_native);
G_OBJECT_CLASS (meta_clutter_backend_native_parent_class)->finalize (object);
}
static void static void
meta_clutter_backend_native_init (MetaClutterBackendNative *clutter_backend_nativen) meta_clutter_backend_native_init (MetaClutterBackendNative *clutter_backend_nativen)
{ {
@ -133,8 +144,11 @@ meta_clutter_backend_native_init (MetaClutterBackendNative *clutter_backend_nati
static void static void
meta_clutter_backend_native_class_init (MetaClutterBackendNativeClass *klass) meta_clutter_backend_native_class_init (MetaClutterBackendNativeClass *klass)
{ {
GObjectClass *object_class = G_OBJECT_CLASS (klass);
ClutterBackendClass *clutter_backend_class = CLUTTER_BACKEND_CLASS (klass); ClutterBackendClass *clutter_backend_class = CLUTTER_BACKEND_CLASS (klass);
object_class->finalize = meta_clutter_backend_native_finalize;
clutter_backend_class->get_renderer = meta_clutter_backend_native_get_renderer; clutter_backend_class->get_renderer = meta_clutter_backend_native_get_renderer;
clutter_backend_class->create_stage = meta_clutter_backend_native_create_stage; clutter_backend_class->create_stage = meta_clutter_backend_native_create_stage;
clutter_backend_class->init_events = meta_clutter_backend_native_init_events; clutter_backend_class->init_events = meta_clutter_backend_native_init_events;