plugins/default: Hold reference on timelines while stopping

We get implicit, thus auto-removed, transitions, then manage them
manually by stopping them and emitting "completed" signals. This doesn't
work since they are removed and freed when stopped. To be able to emit
the "completed" signal, hold a reference while stopping, so that we
still can emit the signal as before.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/828
This commit is contained in:
Jonas Ådahl 2019-10-07 19:54:31 +02:00
parent 6ee006c851
commit fb6e2743ec

View File

@ -811,6 +811,15 @@ hide_tile_preview (MetaPlugin *plugin)
clutter_actor_hide (preview->actor);
}
static void
finish_timeline (ClutterTimeline *timeline)
{
g_object_ref (timeline);
clutter_timeline_stop (timeline);
g_signal_emit_by_name (timeline, "completed", NULL);
g_object_unref (timeline);
}
static void
kill_switch_workspace (MetaPlugin *plugin)
{
@ -818,9 +827,11 @@ kill_switch_workspace (MetaPlugin *plugin)
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);
}
}
@ -833,22 +844,13 @@ kill_window_effects (MetaPlugin *plugin,
apriv = get_actor_private (window_actor);
if (apriv->tml_minimize)
{
clutter_timeline_stop (apriv->tml_minimize);
g_signal_emit_by_name (apriv->tml_minimize, "completed", NULL);
}
finish_timeline (apriv->tml_minimize);
if (apriv->tml_map)
{
clutter_timeline_stop (apriv->tml_map);
g_signal_emit_by_name (apriv->tml_map, "completed", NULL);
}
finish_timeline (apriv->tml_map);
if (apriv->tml_destroy)
{
clutter_timeline_stop (apriv->tml_destroy);
g_signal_emit_by_name (apriv->tml_destroy, "completed", NULL);
}
finish_timeline (apriv->tml_destroy);
}
static const MetaPluginInfo *