mirror of
https://github.com/brl/mutter.git
synced 2024-11-21 23:50:41 -05:00
backend: Destroy clutter backend explicitly
Instead of relying on reference counting, destroy it with a destroy function that calls run_dispose() on before removing a reference. Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1775>
This commit is contained in:
parent
ab600cafd2
commit
c1810d6947
@ -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__ */
|
||||
|
@ -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);
|
||||
}
|
||||
|
@ -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);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user