]> git.sesse.net Git - vlc/blobdiff - modules/misc/testsuite/test4.c
misc/objects.c: Don't rely on vlc_object_destroy() to destroy objects, but expects...
[vlc] / modules / misc / testsuite / test4.c
index 876b2feceaf3a73fb21861ce1396d81211e477ae..2349da13654d94604a907cf04e44e08b7fa117c7 100644 (file)
@@ -10,7 +10,7 @@
  * it under the terms of the GNU General Public License as published by
  * the Free Software Foundation; either version 2 of the License, or
  * (at your option) any later version.
- * 
+ *
  * This program is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 /*****************************************************************************
  * Preamble
  *****************************************************************************/
+#ifdef HAVE_CONFIG_H
+# include "config.h"
+#endif
+
 #include <vlc/vlc.h>
 
 #include <signal.h>
@@ -177,7 +181,7 @@ static int Callback( vlc_object_t *p_this, char const *psz_cmd,
         vlc_object_kill( pp_objects[i] );
         vlc_thread_join( pp_objects[i] );
         vlc_object_detach( pp_objects[i] );
-        vlc_object_destroy( pp_objects[i] );
+        vlc_object_release( pp_objects[i] );
     }
 
     /* Clean our mess */
@@ -215,7 +219,7 @@ static int MyCallback( vlc_object_t *p_this, char const *psz_var,
     sprintf( psz_newvar, "blork-%i", i_var );
     var_Set( p_this, psz_newvar, newval );
 
-    return VLC_SUCCESS;   
+    return VLC_SUCCESS;
 }
 
 /*****************************************************************************
@@ -302,14 +306,14 @@ static int Stress( vlc_object_t *p_this, char const *psz_cmd,
     for( i = MAXLOOK * i_level; i--; )
     {
         int id = (int) (MAXOBJ * i_level * 1.0 * rand() / (RAND_MAX));
-        vlc_object_get( p_this, pp_objects[id]->i_object_id );
+        vlc_object_get( pp_objects[id]->i_object_id );
         vlc_object_release( p_this );
     }
 
     printf( " - destroying the objects (LIFO)\n" );
     for( i = MAXOBJ * i_level; i--; )
     {
-        vlc_object_destroy( pp_objects[i] );
+        vlc_object_release( pp_objects[i] );
     }
 
     printf( "done (%fs).\n", (mdate() - start) / 1000000.0 );
@@ -389,7 +393,7 @@ static int Stress( vlc_object_t *p_this, char const *psz_cmd,
     {
         pp_objects[i]->b_die = VLC_TRUE;
         vlc_thread_join( pp_objects[i] );
-        vlc_object_destroy( pp_objects[i] );
+        vlc_object_release( pp_objects[i] );
     }
 
     printf( "done (%fs).\n", (mdate() - start) / 1000000.0 );
@@ -424,7 +428,7 @@ static void * Dummy( vlc_object_t *p_this )
 
     for( i = MAXOBJ/MAXTH; i--; )
     {
-        vlc_object_destroy( pp_objects[i] );
+        vlc_object_release( pp_objects[i] );
     }
 
     return NULL;