[Xfce4-commits] [apps/xfdashboard] 03/03: Replace returning valid but empty animation in xfdashboard_theme_animation_create() with NULL pointer
noreply at xfce.org
noreply at xfce.org
Mon Apr 6 15:05:42 CEST 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 f20aa9742a3c0effbbffb5922a705afd428f05c5
Author: Stephan Haller <nomad at froevel.de>
Date: Mon Apr 6 12:28:26 2020 +0200
Replace returning valid but empty animation in xfdashboard_theme_animation_create() with NULL pointer
---
libxfdashboard/actor.c | 11 +++++++----
libxfdashboard/theme-animation.c | 23 +++++------------------
2 files changed, 12 insertions(+), 22 deletions(-)
diff --git a/libxfdashboard/actor.c b/libxfdashboard/actor.c
index 9073ebc..90cab65 100644
--- a/libxfdashboard/actor.c
+++ b/libxfdashboard/actor.c
@@ -245,10 +245,12 @@ static void _xfdashboard_actor_on_mapped_changed(GObject *inObject,
* run it.
*/
priv->firstTimeMappedAnimation=xfdashboard_animation_new(XFDASHBOARD_ACTOR(self), "created");
- if(!xfdashboard_animation_get_id(priv->firstTimeMappedAnimation))
+ if(!priv->firstTimeMappedAnimation ||
+ !xfdashboard_animation_get_id(priv->firstTimeMappedAnimation) ||
+ xfdashboard_animation_is_empty(priv->firstTimeMappedAnimation))
{
/* Empty or invalid animation, so release allocated resources and return */
- g_object_unref(priv->firstTimeMappedAnimation);
+ if(priv->firstTimeMappedAnimation) g_object_unref(priv->firstTimeMappedAnimation);
priv->firstTimeMappedAnimation=NULL;
return;
@@ -903,10 +905,11 @@ static XfdashboardAnimation* _xfdashboard_actor_add_animation(XfdashboardActor *
* (i.e. has an ID) add it to list of animations of actor and run it.
*/
animation=xfdashboard_animation_new(XFDASHBOARD_ACTOR(self), inAnimationSignal);
- if(xfdashboard_animation_is_empty(animation))
+ if(!animation ||
+ xfdashboard_animation_is_empty(animation))
{
/* Release animation and return NULL */
- g_object_unref(animation);
+ if(animation) g_object_unref(animation);
return(NULL);
}
diff --git a/libxfdashboard/theme-animation.c b/libxfdashboard/theme-animation.c
index 67cf896..8229fd3 100644
--- a/libxfdashboard/theme-animation.c
+++ b/libxfdashboard/theme-animation.c
@@ -1701,17 +1701,6 @@ XfdashboardAnimation* xfdashboard_theme_animation_create(XfdashboardThemeAnimati
animation=NULL;
animationActorMap=NULL;
- /* Create empty animation */
- animation=g_object_new(XFDASHBOARD_TYPE_ANIMATION,
- NULL);
- if(!animation)
- {
- g_critical(_("Cannot allocate memory for animation of sender '%s' and signal '%s'"),
- G_OBJECT_TYPE_NAME(inSender),
- inSignal);
- return(NULL);
- }
-
/* Check if user wants animation at all. If user does not want any animation,
* return the empty one.
*/
@@ -1722,8 +1711,8 @@ XfdashboardAnimation* xfdashboard_theme_animation_create(XfdashboardThemeAnimati
{
XFDASHBOARD_DEBUG(self, ANIMATION, "User disabled animations");
- /* Return empty animation object as user does not want any animation */
- return(animation);
+ /* Return NULL as user does not want any animation */
+ return(NULL);
}
/* Get best matching animation specification for sender and signal.
@@ -1737,13 +1726,11 @@ XfdashboardAnimation* xfdashboard_theme_animation_create(XfdashboardThemeAnimati
G_OBJECT_TYPE_NAME(inSender),
inSignal);
- /* Return empty animation object as no matching animation specification was found */
- return(animation);
+ /* Return NULL as no matching animation specification was found */
+ return(NULL);
}
- /* Create new animation for animation specification */
- g_object_unref(animation);
-
+ /* Create animation for animation specification */
animation=g_object_new(XFDASHBOARD_TYPE_ANIMATION,
"id", spec->id,
NULL);
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.
More information about the Xfce4-commits
mailing list