[vlc-devel] commit: Warn inheriting a value from an object outside of the object tree ( Rémi Denis-Courmont )

git version control git at videolan.org
Thu Jan 28 17:57:32 CET 2010


vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Thu Jan 28 18:55:47 2010 +0200| [3daab2d0793920a31d75707c4241e24f4432b768] | committer: Rémi Denis-Courmont 

Warn inheriting a value from an object outside of the object tree

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

 src/misc/variables.c |   19 +++++++++++++++++++
 1 files changed, 19 insertions(+), 0 deletions(-)

diff --git a/src/misc/variables.c b/src/misc/variables.c
index 89ade8e..406c1aa 100644
--- a/src/misc/variables.c
+++ b/src/misc/variables.c
@@ -1220,10 +1220,29 @@ static void CheckValue ( variable_t *p_var, vlc_value_t *p_val )
 int var_Inherit( vlc_object_t *p_this, const char *psz_name, int i_type,
                  vlc_value_t *p_val )
 {
+#ifndef NDEBUG
+    if (p_this != VLC_OBJECT(p_this->p_libvlc)
+     && unlikely(p_this->p_parent == NULL))
+    {
+        msg_Info (p_this, "%s(%s) on detached object", __func__, psz_name);
+        //vlc_backtrace ();
+    }
+#endif
     i_type &= VLC_VAR_CLASS;
     for( vlc_object_t *obj = p_this; obj != NULL; obj = obj->p_parent )
+    {
         if( var_GetChecked( obj, psz_name, i_type, p_val ) == VLC_SUCCESS )
             return VLC_SUCCESS;
+#ifndef NDEBUG
+        if (obj != p_this && obj != VLC_OBJECT(p_this->p_libvlc)
+         && unlikely(obj->p_parent == NULL))
+        {
+            msg_Info (p_this, "%s(%s) on detached tree [%p] %s", __func__,
+                      psz_name, obj, obj->psz_object_type);
+            //vlc_backtrace ();
+        }
+#endif
+    }
 
     /* else take value from config */
     switch( i_type & VLC_VAR_CLASS )




More information about the vlc-devel mailing list