mirror of
https://github.com/brl/mutter.git
synced 2024-11-25 17:40:40 -05:00
backend: Tear down in dispose() instead of finalize()
This means backend implementations can have more control of the order of how things are destroyed. To be precise, this will, in the next commit, allow us to destroy the logind integration after the clutter backend thus the libinput owning seat, that uses the logind integration to release input devices. Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1670>
This commit is contained in:
parent
05765daabf
commit
db6bf9d14e
@ -191,12 +191,16 @@ G_DEFINE_ABSTRACT_TYPE_WITH_CODE (MetaBackend, meta_backend, G_TYPE_OBJECT,
|
|||||||
initable_iface_init));
|
initable_iface_init));
|
||||||
|
|
||||||
static void
|
static void
|
||||||
meta_backend_finalize (GObject *object)
|
meta_backend_dispose (GObject *object)
|
||||||
{
|
{
|
||||||
MetaBackend *backend = META_BACKEND (object);
|
MetaBackend *backend = META_BACKEND (object);
|
||||||
MetaBackendPrivate *priv = meta_backend_get_instance_private (backend);
|
MetaBackendPrivate *priv = meta_backend_get_instance_private (backend);
|
||||||
|
|
||||||
|
if (priv->gpus)
|
||||||
|
{
|
||||||
g_list_free_full (priv->gpus, g_object_unref);
|
g_list_free_full (priv->gpus, g_object_unref);
|
||||||
|
priv->gpus = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
g_clear_object (&priv->current_device);
|
g_clear_object (&priv->current_device);
|
||||||
g_clear_object (&priv->monitor_manager);
|
g_clear_object (&priv->monitor_manager);
|
||||||
@ -213,9 +217,17 @@ meta_backend_finalize (GObject *object)
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (priv->sleep_signal_id)
|
if (priv->sleep_signal_id)
|
||||||
|
{
|
||||||
g_dbus_connection_signal_unsubscribe (priv->system_bus, priv->sleep_signal_id);
|
g_dbus_connection_signal_unsubscribe (priv->system_bus, priv->sleep_signal_id);
|
||||||
|
priv->sleep_signal_id = 0;
|
||||||
|
}
|
||||||
|
|
||||||
if (priv->upower_watch_id)
|
if (priv->upower_watch_id)
|
||||||
|
{
|
||||||
g_bus_unwatch_name (priv->upower_watch_id);
|
g_bus_unwatch_name (priv->upower_watch_id);
|
||||||
|
priv->upower_watch_id = 0;
|
||||||
|
}
|
||||||
|
|
||||||
g_cancellable_cancel (priv->cancellable);
|
g_cancellable_cancel (priv->cancellable);
|
||||||
g_clear_object (&priv->cancellable);
|
g_clear_object (&priv->cancellable);
|
||||||
g_clear_object (&priv->system_bus);
|
g_clear_object (&priv->system_bus);
|
||||||
@ -223,7 +235,7 @@ meta_backend_finalize (GObject *object)
|
|||||||
|
|
||||||
g_clear_handle_id (&priv->device_update_idle_id, g_source_remove);
|
g_clear_handle_id (&priv->device_update_idle_id, g_source_remove);
|
||||||
|
|
||||||
g_hash_table_destroy (priv->device_monitors);
|
g_clear_pointer (&priv->device_monitors, g_hash_table_destroy);
|
||||||
|
|
||||||
g_clear_object (&priv->settings);
|
g_clear_object (&priv->settings);
|
||||||
|
|
||||||
@ -233,7 +245,7 @@ meta_backend_finalize (GObject *object)
|
|||||||
|
|
||||||
g_clear_object (&priv->clutter_backend);
|
g_clear_object (&priv->clutter_backend);
|
||||||
|
|
||||||
G_OBJECT_CLASS (meta_backend_parent_class)->finalize (object);
|
G_OBJECT_CLASS (meta_backend_parent_class)->dispose (object);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@ -805,7 +817,7 @@ meta_backend_class_init (MetaBackendClass *klass)
|
|||||||
const gchar *mutter_stage_views;
|
const gchar *mutter_stage_views;
|
||||||
GObjectClass *object_class = G_OBJECT_CLASS (klass);
|
GObjectClass *object_class = G_OBJECT_CLASS (klass);
|
||||||
|
|
||||||
object_class->finalize = meta_backend_finalize;
|
object_class->dispose = meta_backend_dispose;
|
||||||
object_class->constructed = meta_backend_constructed;
|
object_class->constructed = meta_backend_constructed;
|
||||||
|
|
||||||
klass->post_init = meta_backend_real_post_init;
|
klass->post_init = meta_backend_real_post_init;
|
||||||
|
@ -89,18 +89,21 @@ static void
|
|||||||
disconnect_udev_device_added_handler (MetaBackendNative *native);
|
disconnect_udev_device_added_handler (MetaBackendNative *native);
|
||||||
|
|
||||||
static void
|
static void
|
||||||
meta_backend_native_finalize (GObject *object)
|
meta_backend_native_dispose (GObject *object)
|
||||||
{
|
{
|
||||||
MetaBackendNative *native = META_BACKEND_NATIVE (object);
|
MetaBackendNative *native = META_BACKEND_NATIVE (object);
|
||||||
|
|
||||||
if (native->udev_device_added_handler_id)
|
if (native->udev_device_added_handler_id)
|
||||||
|
{
|
||||||
disconnect_udev_device_added_handler (native);
|
disconnect_udev_device_added_handler (native);
|
||||||
|
native->udev_device_added_handler_id = 0;
|
||||||
|
}
|
||||||
|
|
||||||
g_clear_object (&native->kms);
|
g_clear_object (&native->kms);
|
||||||
g_clear_object (&native->udev);
|
g_clear_object (&native->udev);
|
||||||
meta_launcher_free (native->launcher);
|
g_clear_pointer (&native->launcher, meta_launcher_free);
|
||||||
|
|
||||||
G_OBJECT_CLASS (meta_backend_native_parent_class)->finalize (object);
|
G_OBJECT_CLASS (meta_backend_native_parent_class)->dispose (object);
|
||||||
}
|
}
|
||||||
|
|
||||||
static ClutterBackend *
|
static ClutterBackend *
|
||||||
@ -521,7 +524,7 @@ meta_backend_native_class_init (MetaBackendNativeClass *klass)
|
|||||||
MetaBackendClass *backend_class = META_BACKEND_CLASS (klass);
|
MetaBackendClass *backend_class = META_BACKEND_CLASS (klass);
|
||||||
GObjectClass *object_class = G_OBJECT_CLASS (klass);
|
GObjectClass *object_class = G_OBJECT_CLASS (klass);
|
||||||
|
|
||||||
object_class->finalize = meta_backend_native_finalize;
|
object_class->dispose = meta_backend_native_dispose;
|
||||||
|
|
||||||
backend_class->create_clutter_backend = meta_backend_native_create_clutter_backend;
|
backend_class->create_clutter_backend = meta_backend_native_create_clutter_backend;
|
||||||
|
|
||||||
|
@ -848,7 +848,7 @@ initable_iface_init (GInitableIface *initable_iface)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
meta_backend_x11_finalize (GObject *object)
|
meta_backend_x11_dispose (GObject *object)
|
||||||
{
|
{
|
||||||
MetaBackend *backend = META_BACKEND (object);
|
MetaBackend *backend = META_BACKEND (object);
|
||||||
MetaBackendX11 *x11 = META_BACKEND_X11 (object);
|
MetaBackendX11 *x11 = META_BACKEND_X11 (object);
|
||||||
@ -871,7 +871,7 @@ meta_backend_x11_finalize (GObject *object)
|
|||||||
priv->user_active_alarm = None;
|
priv->user_active_alarm = None;
|
||||||
}
|
}
|
||||||
|
|
||||||
G_OBJECT_CLASS (meta_backend_x11_parent_class)->finalize (object);
|
G_OBJECT_CLASS (meta_backend_x11_parent_class)->dispose (object);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@ -880,7 +880,7 @@ meta_backend_x11_class_init (MetaBackendX11Class *klass)
|
|||||||
MetaBackendClass *backend_class = META_BACKEND_CLASS (klass);
|
MetaBackendClass *backend_class = META_BACKEND_CLASS (klass);
|
||||||
GObjectClass *object_class = G_OBJECT_CLASS (klass);
|
GObjectClass *object_class = G_OBJECT_CLASS (klass);
|
||||||
|
|
||||||
object_class->finalize = meta_backend_x11_finalize;
|
object_class->dispose = meta_backend_x11_dispose;
|
||||||
backend_class->create_clutter_backend = meta_backend_x11_create_clutter_backend;
|
backend_class->create_clutter_backend = meta_backend_x11_create_clutter_backend;
|
||||||
backend_class->post_init = meta_backend_x11_post_init;
|
backend_class->post_init = meta_backend_x11_post_init;
|
||||||
backend_class->grab_device = meta_backend_x11_grab_device;
|
backend_class->grab_device = meta_backend_x11_grab_device;
|
||||||
|
Loading…
Reference in New Issue
Block a user