From efb0f83d1f82fa356aaacfd9bec57f7eadc71b27 Mon Sep 17 00:00:00 2001 From: Julian Bouzas Date: Tue, 1 Jun 2021 13:43:00 -0400 Subject: [PATCH] object: use destroy notify to keep self alive while advancing transitions --- lib/wp/object.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/lib/wp/object.c b/lib/wp/object.c index cd2c920e..1ca284a8 100644 --- a/lib/wp/object.c +++ b/lib/wp/object.c @@ -308,10 +308,6 @@ wp_object_get_supported_features (WpObject * self) static gboolean wp_object_advance_transitions (WpObject * self) { - /* keep \a self alive; in rare cases, the last transition may be - holding the last ref on \a self and g_queue_peek_head will crash - right after droping that last ref */ - g_autoptr (WpObject) self_ref = g_object_ref (self); WpObjectPrivate *priv = wp_object_get_instance_private (self); WpTransition *t; @@ -390,7 +386,8 @@ wp_object_activate_closure (WpObject * self, if (!priv->idle_advnc_source) { wp_core_idle_add (core, &priv->idle_advnc_source, - G_SOURCE_FUNC (wp_object_advance_transitions), self, NULL); + G_SOURCE_FUNC (wp_object_advance_transitions), g_object_ref (self), + g_object_unref); } } @@ -472,6 +469,7 @@ wp_object_update_features (WpObject * self, WpObjectFeatures activated, g_return_if_fail (core != NULL); wp_core_idle_add (core, &priv->idle_advnc_source, - G_SOURCE_FUNC (wp_object_advance_transitions), self, NULL); + G_SOURCE_FUNC (wp_object_advance_transitions), g_object_ref (self), + g_object_unref); } }