From 321b971a9613dca63795df1c601c55e0a7b713aa Mon Sep 17 00:00:00 2001 From: Carlos Garnacho Date: Sat, 21 Nov 2020 14:05:08 +0100 Subject: [PATCH] backends/native: Add missing seat finalization paths On finalize we leak the clutter backend, which leaks the stage and seat. Part-of: --- src/backends/meta-backend.c | 2 ++ src/backends/native/meta-clutter-backend-native.c | 14 ++++++++++++++ 2 files changed, 16 insertions(+) diff --git a/src/backends/meta-backend.c b/src/backends/meta-backend.c index b208a5395..aca0d6fc9 100644 --- a/src/backends/meta-backend.c +++ b/src/backends/meta-backend.c @@ -231,6 +231,8 @@ meta_backend_finalize (GObject *object) g_clear_object (&priv->profiler); #endif + g_clear_object (&priv->clutter_backend); + G_OBJECT_CLASS (meta_backend_parent_class)->finalize (object); } diff --git a/src/backends/native/meta-clutter-backend-native.c b/src/backends/native/meta-clutter-backend-native.c index 58d6afa44..a1d0d0971 100644 --- a/src/backends/native/meta-clutter-backend-native.c +++ b/src/backends/native/meta-clutter-backend-native.c @@ -125,6 +125,17 @@ meta_clutter_backend_native_is_display_server (ClutterBackend *backend) 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 meta_clutter_backend_native_init (MetaClutterBackendNative *clutter_backend_nativen) { @@ -133,8 +144,11 @@ meta_clutter_backend_native_init (MetaClutterBackendNative *clutter_backend_nati static void meta_clutter_backend_native_class_init (MetaClutterBackendNativeClass *klass) { + GObjectClass *object_class = G_OBJECT_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->create_stage = meta_clutter_backend_native_create_stage; clutter_backend_class->init_events = meta_clutter_backend_native_init_events;