[vlc-commits] objects: small code factor
Rémi Denis-Courmont
git at videolan.org
Mon Mar 4 21:05:56 CET 2019
vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Mon Mar 4 18:52:02 2019 +0200| [f38e4a3ae7c70a8901b6675d340f721ea29443f3] | committer: Rémi Denis-Courmont
objects: small code factor
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=f38e4a3ae7c70a8901b6675d340f721ea29443f3
---
src/misc/objects.c | 10 +++-------
1 file changed, 3 insertions(+), 7 deletions(-)
diff --git a/src/misc/objects.c b/src/misc/objects.c
index ad93799223..a3da483307 100644
--- a/src/misc/objects.c
+++ b/src/misc/objects.c
@@ -315,6 +315,8 @@ static void vlc_object_destroy( vlc_object_t *p_this )
assert(p_priv->resources == NULL);
+ int canc = vlc_savecancel();
+
/* Call the custom "subclass" destructor */
if( p_priv->pf_destructor )
p_priv->pf_destructor( p_this );
@@ -328,6 +330,7 @@ static void vlc_object_destroy( vlc_object_t *p_this )
/* Destroy the associated variables. */
var_DestroyAll( p_this );
+ vlc_restorecancel(canc);
vlc_cond_destroy( &p_priv->var_wait );
vlc_mutex_destroy( &p_priv->var_lock );
@@ -398,10 +401,7 @@ void vlc_object_release (vlc_object_t *obj)
assert (refs == 1); /* nobody to race against in this case */
/* no children can be left */
assert(!ObjectHasChild(obj));
-
- int canc = vlc_savecancel ();
vlc_object_destroy (obj);
- vlc_restorecancel (canc);
return;
}
@@ -420,11 +420,7 @@ void vlc_object_release (vlc_object_t *obj)
atomic_thread_fence(memory_order_acquire);
/* no children can be left (because children reference their parent) */
assert(!ObjectHasChild(obj));
-
- int canc = vlc_savecancel ();
vlc_object_destroy (obj);
- vlc_restorecancel (canc);
-
vlc_object_release (parent);
}
}
More information about the vlc-commits
mailing list