[mutter] backend: Cleanup cursor tracker on shutdown
- From: Marge Bot <marge-bot src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [mutter] backend: Cleanup cursor tracker on shutdown
- Date: Wed, 5 May 2021 20:26:21 +0000 (UTC)
commit 558cb4fac38522bdb2029cc86f9e1f6b4730abfd
Author: Jonas Ã…dahl <jadahl gmail com>
Date: Sat Apr 10 00:44:45 2021 +0200
backend: Cleanup cursor tracker on shutdown
It keeps references to cursors, and cursors keep references to DRM
buffers. In order to be able to clean up on exit, explicitly destroy the
cursor tracker on shutdown.
We can't rely on GObject reference counting, as gjs might hold onto a
reference until it's garbage collected.
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1822>
src/backends/meta-backend.c | 1 +
src/backends/meta-cursor-tracker-private.h | 2 ++
src/backends/meta-cursor-tracker.c | 13 ++++++++++---
3 files changed, 13 insertions(+), 3 deletions(-)
---
diff --git a/src/backends/meta-backend.c b/src/backends/meta-backend.c
index 45e8b6d3b3..e40452d030 100644
--- a/src/backends/meta-backend.c
+++ b/src/backends/meta-backend.c
@@ -199,6 +199,7 @@ meta_backend_dispose (GObject *object)
MetaBackend *backend = META_BACKEND (object);
MetaBackendPrivate *priv = meta_backend_get_instance_private (backend);
+ g_clear_pointer (&priv->cursor_tracker, meta_cursor_tracker_destroy);
g_clear_object (&priv->current_device);
g_clear_object (&priv->monitor_manager);
g_clear_object (&priv->orientation_manager);
diff --git a/src/backends/meta-cursor-tracker-private.h b/src/backends/meta-cursor-tracker-private.h
index 6d3c88c355..2d8d380428 100644
--- a/src/backends/meta-cursor-tracker-private.h
+++ b/src/backends/meta-cursor-tracker-private.h
@@ -51,4 +51,6 @@ MetaBackend * meta_cursor_tracker_get_backend (MetaCursorTracker *tracker);
void meta_cursor_tracker_notify_cursor_changed (MetaCursorTracker *tracker);
+void meta_cursor_tracker_destroy (MetaCursorTracker *tracker);
+
#endif
diff --git a/src/backends/meta-cursor-tracker.c b/src/backends/meta-cursor-tracker.c
index d2bd22606a..24776e266f 100644
--- a/src/backends/meta-cursor-tracker.c
+++ b/src/backends/meta-cursor-tracker.c
@@ -190,6 +190,13 @@ meta_cursor_tracker_real_get_sprite (MetaCursorTracker *tracker)
return priv->displayed_cursor;
}
+void
+meta_cursor_tracker_destroy (MetaCursorTracker *tracker)
+{
+ g_object_run_dispose (G_OBJECT (tracker));
+ g_object_unref (tracker);
+}
+
static void
meta_cursor_tracker_init (MetaCursorTracker *tracker)
{
@@ -244,7 +251,7 @@ meta_cursor_tracker_set_property (GObject *object,
}
static void
-meta_cursor_tracker_finalize (GObject *object)
+meta_cursor_tracker_dispose (GObject *object)
{
MetaCursorTracker *tracker = META_CURSOR_TRACKER (object);
MetaCursorTrackerPrivate *priv =
@@ -254,7 +261,7 @@ meta_cursor_tracker_finalize (GObject *object)
g_clear_object (&priv->displayed_cursor);
g_clear_object (&priv->root_cursor);
- G_OBJECT_CLASS (meta_cursor_tracker_parent_class)->finalize (object);
+ G_OBJECT_CLASS (meta_cursor_tracker_parent_class)->dispose (object);
}
static void
@@ -264,7 +271,7 @@ meta_cursor_tracker_class_init (MetaCursorTrackerClass *klass)
object_class->get_property = meta_cursor_tracker_get_property;
object_class->set_property = meta_cursor_tracker_set_property;
- object_class->finalize = meta_cursor_tracker_finalize;
+ object_class->dispose = meta_cursor_tracker_dispose;
klass->set_force_track_position =
meta_cursor_tracker_real_set_force_track_position;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]