[Xfce4-commits] [apps/xfdashboard] 01/01: Free list of animation when actor is disposed (remaining TODO ; ) )
noreply at xfce.org
noreply at xfce.org
Tue Feb 4 10:36:06 CET 2020
This is an automated email from the git hooks/post-receive script.
n o m a d p u s h e d a c o m m i t t o b r a n c h m a s t e r
in repository apps/xfdashboard.
commit b55c16fe0e5eab207f449911a91078fbca78ab1b
Author: Stephan Haller <nomad at froevel.de>
Date: Tue Feb 4 10:35:40 2020 +0100
Free list of animation when actor is disposed (remaining TODO ;) )
---
libxfdashboard/actor.c | 14 +++++++++++---
1 file changed, 11 insertions(+), 3 deletions(-)
diff --git a/libxfdashboard/actor.c b/libxfdashboard/actor.c
index a285406..43a97fe 100644
--- a/libxfdashboard/actor.c
+++ b/libxfdashboard/actor.c
@@ -106,6 +106,7 @@ static void _xfdashboard_actor_animation_entry_free(XfdashboardActorAnimationEnt
g_return_if_fail(inData);
/* Release allocated resources */
+ if(inData->animation) g_object_unref(inData->animation);
if(inData->signal) g_free(inData->signal);
g_free(inData);
}
@@ -758,7 +759,11 @@ static void _xfdashboard_actor_animation_done(XfdashboardAnimation *inAnimation,
"Removing stopped animation '%s'",
xfdashboard_animation_get_id(data->animation));
- /* Remove entry from list */
+ /* Remove entry from list, but set pointer to animation in entry
+ * to NULL to avoid unreffing an already disposed or finalized
+ * object instance.
+ */
+ data->animation=NULL;
_xfdashboard_actor_animation_entry_free(data);
priv->animations=g_slist_delete_link(priv->animations, iter);
@@ -807,7 +812,9 @@ static void _xfdashboard_actor_remove_animation(XfdashboardStylable *inStylable,
xfdashboard_animation_get_id(data->animation),
animationSignal);
- /* Stop animation by unreffing object instance */
+ /* Stop animation by unreffing object instance which calls the
+ * done callback _xfdashboard_actor_animation_done() of animation.
+ */
g_object_unref(data->animation);
}
}
@@ -1138,7 +1145,8 @@ static void _xfdashboard_actor_dispose(GObject *inObject)
if(priv->animations)
{
- // TODO: Release list of animations
+ g_slist_free_full(priv->animations, (GDestroyNotify)_xfdashboard_actor_animation_entry_free);
+ priv->animations=NULL;
}
/* Call parent's class dispose method */
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.
More information about the Xfce4-commits
mailing list