From 7bb0055acd436ede3ec701d477ef9494bdf267a3 Mon Sep 17 00:00:00 2001 From: Erik Massop Date: Sun, 28 Nov 2021 00:14:28 +0000 Subject: [PATCH] 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: --- 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 e3fbfb40c..f762b3e6e 100644 --- a/src/compositor/plugins/default.c +++ b/src/compositor/plugins/default.c @@ -897,17 +897,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); } }