[mutter/gnome-41] cursor: Hold reference to cursor tracker



commit ea67a06332beb817099f1c1d2b5bb1a8c9a49f4b
Author: Jonas Ådahl <jadahl gmail com>
Date:   Wed Dec 22 19:37:16 2021 +0100

    cursor: Hold reference to cursor tracker
    
    This is so that it can unregister from it on tear down. The tracker owns
    references to cursors too, but this cycle is already broken as the
    backend calls 'g_object_run_dispose()' when tearing the cursor tracker
    down.
    
    Fixes a crash on shutdown.

 src/backends/meta-cursor.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
---
diff --git a/src/backends/meta-cursor.c b/src/backends/meta-cursor.c
index f8b64a42f3..9360b031e4 100644
--- a/src/backends/meta-cursor.c
+++ b/src/backends/meta-cursor.c
@@ -243,6 +243,7 @@ meta_cursor_sprite_finalize (GObject *object)
   g_clear_pointer (&priv->texture, cogl_object_unref);
 
   meta_cursor_tracker_unregister_cursor_sprite (priv->cursor_tracker, sprite);
+  g_clear_object (&priv->cursor_tracker);
 
   G_OBJECT_CLASS (meta_cursor_sprite_parent_class)->finalize (object);
 }
@@ -260,7 +261,7 @@ meta_cursor_tracker_set_property (GObject      *object,
   switch (prop_id)
     {
     case PROP_CURSOR_TRACKER:
-      priv->cursor_tracker = g_value_get_object (value);
+      g_set_object (&priv->cursor_tracker, g_value_get_object (value));
       break;
     default:
       G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]