diff --git a/clutter/clutter/clutter-backend-private.h b/clutter/clutter/clutter-backend-private.h index 2f67c77ba..9309bdd01 100644 --- a/clutter/clutter/clutter-backend-private.h +++ b/clutter/clutter/clutter-backend-private.h @@ -139,6 +139,9 @@ float clutter_backend_get_fallback_resource_scale (ClutterBackend *backend); gboolean clutter_backend_is_display_server (ClutterBackend *backend); +CLUTTER_EXPORT +void clutter_backend_destroy (ClutterBackend *backend); + G_END_DECLS #endif /* __CLUTTER_BACKEND_PRIVATE_H__ */ diff --git a/clutter/clutter/clutter-backend.c b/clutter/clutter/clutter-backend.c index f49d93cac..c90fabb42 100644 --- a/clutter/clutter/clutter-backend.c +++ b/clutter/clutter/clutter-backend.c @@ -99,21 +99,12 @@ clutter_backend_dispose (GObject *gobject) backend->stage_window = NULL; } - G_OBJECT_CLASS (clutter_backend_parent_class)->dispose (gobject); -} - -static void -clutter_backend_finalize (GObject *gobject) -{ - ClutterBackend *backend = CLUTTER_BACKEND (gobject); - - g_source_destroy (backend->cogl_source); - - g_free (backend->font_name); + g_clear_pointer (&backend->cogl_source, g_source_destroy); + g_clear_pointer (&backend->font_name, g_free); g_clear_pointer (&backend->font_options, cairo_font_options_destroy); g_clear_object (&backend->input_method); - G_OBJECT_CLASS (clutter_backend_parent_class)->finalize (gobject); + G_OBJECT_CLASS (clutter_backend_parent_class)->dispose (gobject); } static gfloat @@ -451,7 +442,6 @@ clutter_backend_class_init (ClutterBackendClass *klass) GObjectClass *gobject_class = G_OBJECT_CLASS (klass); gobject_class->dispose = clutter_backend_dispose; - gobject_class->finalize = clutter_backend_finalize; /** * ClutterBackend::resolution-changed: @@ -933,3 +923,10 @@ clutter_backend_is_display_server (ClutterBackend *backend) { return CLUTTER_BACKEND_GET_CLASS (backend)->is_display_server (backend); } + +void +clutter_backend_destroy (ClutterBackend *backend) +{ + g_object_run_dispose (G_OBJECT (backend)); + g_object_unref (backend); +} diff --git a/src/backends/meta-backend.c b/src/backends/meta-backend.c index f2b7bd89a..0a8fb872e 100644 --- a/src/backends/meta-backend.c +++ b/src/backends/meta-backend.c @@ -247,7 +247,7 @@ meta_backend_dispose (GObject *object) #endif g_clear_pointer (&priv->default_seat, clutter_seat_destroy); - g_clear_object (&priv->clutter_backend); + g_clear_pointer (&priv->clutter_backend, clutter_backend_destroy); G_OBJECT_CLASS (meta_backend_parent_class)->dispose (object); }