[vlc-commits] variables: do not wait for callbacks in destroy

Rémi Denis-Courmont git at videolan.org
Sat Oct 22 18:57:04 CEST 2016


vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Sat Oct 22 19:50:46 2016 +0300| [f14f2a50d8c85557678d32b7b19938ca96c32ae2] | committer: Rémi Denis-Courmont

variables: do not wait for callbacks in destroy

Destroying a variable while its callbacks are in use is not fully
defined regardless. So we just assume that callbacks are not running.

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

 src/misc/variables.c | 15 ++++++++-------
 1 file changed, 8 insertions(+), 7 deletions(-)

diff --git a/src/misc/variables.c b/src/misc/variables.c
index 9c03b92..6114f97 100644
--- a/src/misc/variables.c
+++ b/src/misc/variables.c
@@ -404,17 +404,18 @@ void (var_Destroy)(vlc_object_t *p_this, const char *psz_name)
 
     p_var = Lookup( p_this, psz_name );
     if( p_var == NULL )
+        msg_Dbg( p_this, "attempt to destroy nonexistent variable \"%s\"",
+                 psz_name );
+    else if( --p_var->i_usage == 0 )
     {
-        vlc_mutex_unlock( &p_priv->var_lock );
-        return;
-    }
-
-    WaitUnused( p_this, p_var );
-
-    if( --p_var->i_usage == 0 )
+        assert(!p_var->b_incallback);
         tdelete( p_var, &p_priv->var_root, varcmp );
+    }
     else
+    {
+        assert(p_var->i_usage != -1u);
         p_var = NULL;
+    }
     vlc_mutex_unlock( &p_priv->var_lock );
 
     if( p_var != NULL )



More information about the vlc-commits mailing list