[vlc-devel] commit: Only insert new object into the table one initialized ( Rémi Denis-Courmont )

git version control git at videolan.org
Wed May 7 22:11:47 CEST 2008


vlc | branch: master | Rémi Denis-Courmont <rem at videolan.org> | Wed May  7 22:53:15 2008 +0300| [5421e9cd54ac4384583f13daf9323304e532c257]

Only insert new object into the table one initialized

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=5421e9cd54ac4384583f13daf9323304e532c257
---

 src/misc/objects.c |   18 +++++++++---------
 1 files changed, 9 insertions(+), 9 deletions(-)

diff --git a/src/misc/objects.c b/src/misc/objects.c
index 4ec786b..79381e5 100644
--- a/src/misc/objects.c
+++ b/src/misc/objects.c
@@ -169,15 +169,6 @@ void *vlc_custom_create( vlc_object_t *p_this, size_t i_size,
         }
     }
 
-    vlc_mutex_lock( &structure_lock );
-    p_new->i_object_id = p_libvlc_global->i_counter++;
-
-    /* Wooohaa! If *this* fails, we're in serious trouble! Anyway it's
-     * useless to try and recover anything if pp_objects gets smashed. */
-    TAB_APPEND( p_libvlc_global->i_objects, p_libvlc_global->pp_objects,
-                p_new );
-    vlc_mutex_unlock( &structure_lock );
-
     p_priv->i_refcount = 1;
     p_priv->pf_destructor = kVLCDestructor;
     p_priv->b_thread = false;
@@ -194,6 +185,15 @@ void *vlc_custom_create( vlc_object_t *p_this, size_t i_size,
     vlc_spin_init( &p_priv->spin );
     p_priv->pipes[0] = p_priv->pipes[1] = -1;
 
+    vlc_mutex_lock( &structure_lock );
+    p_new->i_object_id = p_libvlc_global->i_counter++;
+
+    /* Wooohaa! If *this* fails, we're in serious trouble! Anyway it's
+     * useless to try and recover anything if pp_objects gets smashed. */
+    TAB_APPEND( p_libvlc_global->i_objects, p_libvlc_global->pp_objects,
+                p_new );
+    vlc_mutex_unlock( &structure_lock );
+
     if( i_type == VLC_OBJECT_LIBVLC )
     {
         var_Create( p_new, "list", VLC_VAR_STRING | VLC_VAR_ISCOMMAND );




More information about the vlc-devel mailing list