[mutter/gnome-40] plugins/default: Use local vars for refs



commit 53d9aad75bf2490198abc7c82ce531a3fef6c938
Author: Erik Massop <emassop google com>
Date:   Sun Nov 28 00:14:28 2021 +0000

    plugins/default: Use local vars for refs
    
    Since the completion callback (on_switch_workspace_effect_complete) sets
    priv->tml_switch_workspace1 to NULL, the unref was trying to unref NULL,
    and the reffed ClutterTimeline was not getting unreffed.
    
    This could be triggered by rapidly switching workspaces, switching again
    before the animation of the initial switch was done.
    
    Found while working on #2038.
    
    Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2120>
    (cherry picked from commit 7bb0055acd436ede3ec701d477ef9494bdf267a3)

 src/compositor/plugins/default.c | 15 +++++++++------
 1 file changed, 9 insertions(+), 6 deletions(-)
---
diff --git a/src/compositor/plugins/default.c b/src/compositor/plugins/default.c
index 11aa505bab..0b57e6c57f 100644
--- a/src/compositor/plugins/default.c
+++ b/src/compositor/plugins/default.c
@@ -907,17 +907,20 @@ finish_timeline (ClutterTimeline *timeline)
 }
 
 static void
-kill_switch_workspace (MetaPlugin     *plugin)
+kill_switch_workspace (MetaPlugin *plugin)
 {
   MetaDefaultPluginPrivate *priv = META_DEFAULT_PLUGIN (plugin)->priv;
 
   if (priv->tml_switch_workspace1)
     {
-      g_object_ref (priv->tml_switch_workspace1);
-      clutter_timeline_stop (priv->tml_switch_workspace1);
-      clutter_timeline_stop (priv->tml_switch_workspace2);
-      g_signal_emit_by_name (priv->tml_switch_workspace1, "completed", NULL);
-      g_object_unref (priv->tml_switch_workspace1);
+      g_autoptr (ClutterTimeline) timeline1 = NULL;
+      g_autoptr (ClutterTimeline) timeline2 = NULL;
+
+      timeline1 = g_object_ref (priv->tml_switch_workspace1);
+      timeline2 = g_object_ref (priv->tml_switch_workspace2);
+
+      finish_timeline (timeline1);
+      finish_timeline (timeline2);
     }
 }
 


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