misc/objects.c: Don't rely on vlc_object_destroy() to destroy objects, but expects...
authorPierre d'Herbemont <pdherbemont@videolan.org>
Tue, 26 Feb 2008 00:29:12 +0000 (00:29 +0000)
committerPierre d'Herbemont <pdherbemont@videolan.org>
Tue, 26 Feb 2008 00:29:12 +0000 (00:29 +0000)
* Meaning, that when created objects gets a refcount to 1.
* Destroying is instantaneous and we don't have to poll for a few secondss or so to wait until the object's refcount reach 0.
* We now track vlc_object_t's mem leaks when libvlc_global is released (Hard error for now, so they don't get unoticed)
* We fail hard if an object is released with a refcount of 1 without being detached from its parent and its children, to make sure such cases don't go unoticed.
(make test or make check still pass after that one. VLC is known to leak one object when no module is loaded, this must be fixed).

71 files changed:
include/vlc_demux.h
include/vlc_objects.h
modules/access/dv.c
modules/access/dvdnav.c
modules/access_output/bonjour.c
modules/access_output/udp.c
modules/audio_output/directx.c
modules/audio_output/waveout.c
modules/codec/ffmpeg/chroma.c
modules/codec/ffmpeg/encoder.c
modules/demux/flac.c
modules/demux/live555.cpp
modules/demux/mkv.cpp
modules/gui/fbosd.c
modules/gui/skins2/src/dialogs.cpp
modules/misc/audioscrobbler.c
modules/misc/freetype.c
modules/misc/gnutls.c
modules/misc/gtk_main.c
modules/misc/qte_main.cpp
modules/misc/testsuite/test4.c
modules/stream_out/mosaic_bridge.c
modules/stream_out/rtp.c
modules/stream_out/transcode.c
modules/video_filter/atmo/AtmoThread.cpp
modules/video_filter/atmo/atmo.cpp
modules/video_filter/logo.c
modules/video_filter/opencv_wrapper.c
modules/video_output/msw/direct3d.c
modules/video_output/msw/directx.c
modules/video_output/msw/glwin32.c
modules/video_output/msw/wingdi.c
modules/video_output/opengl.c
modules/video_output/qte/qte.cpp
modules/visualization/galaktos/plugin.c
modules/visualization/goom.c
src/audio_output/common.c
src/audio_output/filters.c
src/audio_output/input.c
src/control/mediacontrol_audio_video.c
src/input/access.c
src/input/decoder.c
src/input/demux.c
src/input/input.c
src/input/mem_stream.c
src/input/meta.c
src/input/stream.c
src/input/vlm.c
src/interface/interaction.c
src/interface/interface.c
src/libvlc-common.c
src/libvlc.sym
src/misc/beos_specific.cpp
src/misc/devices.c
src/misc/image.c
src/misc/objects.c
src/misc/threads.c
src/misc/update.c
src/misc/xml.c
src/modules/modules.c
src/network/httpd.c
src/network/tls.c
src/osd/osd.c
src/playlist/engine.c
src/playlist/services_discovery.c
src/playlist/thread.c
src/stream_output/announce.c
src/stream_output/sap.c
src/stream_output/stream_output.c
src/video_output/video_output.c
src/video_output/vout_subpictures.c

index 5357cb4..355baf5 100644 (file)
@@ -232,7 +232,7 @@ static inline vlc_bool_t demux2_IsForced( demux_t *p_demux, const char *psz_name
         module_Need( location, "packetizer", NULL, 0 ); \
     if( location->p_module == NULL ) \
     { \
-        vlc_object_destroy( location ); \
+        vlc_object_release( location ); \
         msg_Err( p_demux, "cannot find packetizer for " # msg ); \
         free( p_sys ); \
         return VLC_EGENERIC; \
@@ -240,7 +240,7 @@ static inline vlc_bool_t demux2_IsForced( demux_t *p_demux, const char *psz_name
 
 #define DESTROY_PACKETIZER( location ) \
     if( location->p_module ) module_Unneed( location, location->p_module ); \
-    vlc_object_destroy( location );
+    vlc_object_release( location );
 
 /**
  * @}
index 9d92472..9f9244a 100644 (file)
@@ -95,7 +95,6 @@ struct vlc_object_t
  * Prototypes
  *****************************************************************************/
 VLC_EXPORT( void *, __vlc_object_create, ( vlc_object_t *, int ) );
-VLC_EXPORT( void, __vlc_object_destroy, ( vlc_object_t * ) );
 VLC_EXPORT( void, __vlc_object_attach, ( vlc_object_t *, vlc_object_t * ) );
 VLC_EXPORT( void, __vlc_object_detach, ( vlc_object_t * ) );
 VLC_EXPORT( void *, vlc_object_get, ( int ) );
@@ -111,10 +110,6 @@ VLC_EXPORT( void, vlc_list_release, ( vlc_list_t * ) );
 #define vlc_object_create(a,b) \
     __vlc_object_create( VLC_OBJECT(a), b )
 
-#define vlc_object_destroy(a) do { \
-    __vlc_object_destroy( VLC_OBJECT(a) ); \
-    (a) = NULL; } while(0)
-
 #define vlc_object_detach(a) \
     __vlc_object_detach( VLC_OBJECT(a) )
 
index 3661483..c16be7e 100644 (file)
@@ -271,7 +271,7 @@ static void Close( vlc_object_t *p_this )
             p_sys->p_ev->pp_last = &p_sys->p_frame;
             vlc_mutex_unlock( &p_sys->p_ev->lock );
         }
-        vlc_object_destroy( p_sys->p_ev );
+        vlc_object_release( p_sys->p_ev );
     }
 
     if( p_sys->p_frame )
index 3f2d4cf..79fe01d 100644 (file)
@@ -357,7 +357,7 @@ static void Close( vlc_object_t *p_this )
     /* stop the event handler */
     vlc_object_kill( p_sys->p_ev );
     vlc_thread_join( p_sys->p_ev );
-    vlc_object_destroy( p_sys->p_ev );
+    vlc_object_release( p_sys->p_ev );
 
     var_Destroy( p_sys->p_input, "highlight-mutex" );
     var_Destroy( p_sys->p_input, "highlight" );
index d4dbc14..908673e 100644 (file)
@@ -269,7 +269,7 @@ void *bonjour_start_service( vlc_object_t *p_log, const char *psz_stype,
 
 error:
     if( p_sys->poll_thread != NULL )
-        vlc_object_destroy( p_sys->poll_thread );
+        vlc_object_release( p_sys->poll_thread );
     if( p_sys->client != NULL )
         avahi_client_free( p_sys->client );
     if( p_sys->simple_poll != NULL )
@@ -295,7 +295,7 @@ void bonjour_stop_service( void *_p_sys )
 
     vlc_object_kill( p_sys->poll_thread );
     vlc_thread_join( p_sys->poll_thread );
-    vlc_object_destroy( p_sys->poll_thread );
+    vlc_object_release( p_sys->poll_thread );
 
     if( p_sys->group != NULL )
         avahi_entry_group_free( p_sys->group );
index 0d9277d..40964d4 100644 (file)
@@ -232,7 +232,7 @@ static int Open( vlc_object_t *p_this )
     if( i_handle == -1 )
     {
          msg_Err( p_access, "failed to create raw UDP socket" );
-         vlc_object_destroy (p_sys->p_thread);
+         vlc_object_release (p_sys->p_thread);
          free (p_sys);
          return VLC_EGENERIC;
     }
@@ -271,7 +271,7 @@ static int Open( vlc_object_t *p_this )
     {
         msg_Err( p_access->p_sout, "cannot spawn sout access thread" );
         net_Close (i_handle);
-        vlc_object_destroy( p_sys->p_thread );
+        vlc_object_release( p_sys->p_thread );
         free (p_sys);
         return VLC_EGENERIC;
     }
@@ -316,7 +316,7 @@ static void Close( vlc_object_t * p_this )
     net_Close( p_sys->p_thread->i_handle );
 
     vlc_object_detach( p_sys->p_thread );
-    vlc_object_destroy( p_sys->p_thread );
+    vlc_object_release( p_sys->p_thread );
     /* update p_sout->i_out_pace_nocontrol */
     p_access->p_sout->i_out_pace_nocontrol--;
 
index f025028..2117b60 100644 (file)
@@ -374,7 +374,7 @@ static int OpenAudio( vlc_object_t *p_this )
     {
         msg_Err( p_aout, "cannot create DirectSoundThread" );
         CloseHandle( p_aout->output.p_sys->p_notif->event );
-        vlc_object_destroy( p_aout->output.p_sys->p_notif );
+        vlc_object_release( p_aout->output.p_sys->p_notif );
         p_aout->output.p_sys->p_notif = NULL;
         goto error;
     }
@@ -594,7 +594,7 @@ static void CloseAudio( vlc_object_t *p_this )
         if( !p_sys->b_playing ) SetEvent( p_sys->p_notif->event );
 
         vlc_thread_join( p_sys->p_notif );
-        vlc_object_destroy( p_sys->p_notif );
+        vlc_object_release( p_sys->p_notif );
     }
 
     /* release the secondary buffer */
index b7efbe2..ef04607 100644 (file)
@@ -495,7 +495,7 @@ static void Close( vlc_object_t *p_this )
     /* wake up the audio thread */
     SetEvent( p_sys->event );
     vlc_thread_join( p_sys->p_notif );
-    vlc_object_destroy( p_sys->p_notif );
+    vlc_object_release( p_sys->p_notif );
     CloseHandle( p_sys->event );
 
     /* Close the device */
index 669bf0b..66e6ff4 100644 (file)
@@ -300,7 +300,7 @@ int E_(OpenChroma)( vlc_object_t *p_this )
     if( !p_sys->p_swscaler->p_module || !p_sys->p_swscaler->p_owner )
     {
         vlc_object_detach( p_sys->p_swscaler );
-        vlc_object_destroy( p_sys->p_swscaler );
+        vlc_object_release( p_sys->p_swscaler );
         free( p_vout->chroma.p_sys );
         return VLC_EGENERIC;
     }
@@ -355,7 +355,7 @@ void E_(CloseChroma)( vlc_object_t *p_this )
         free( p_sys->p_swscaler->p_owner );
         module_Unneed( p_sys->p_swscaler, p_sys->p_swscaler->p_module );
         vlc_object_detach( p_sys->p_swscaler );
-        vlc_object_destroy( p_sys->p_swscaler );
+        vlc_object_release( p_sys->p_swscaler );
         p_sys->p_swscaler= NULL;
     }
     free( p_vout->chroma.p_sys );
index a126b9f..c0ec8c8 100644 (file)
@@ -1036,7 +1036,7 @@ void E_(CloseEncoder)( vlc_object_t *p_this )
             vlc_thread_join( pp_contexts[i] );
             vlc_mutex_destroy( &pp_contexts[i]->lock );
             vlc_cond_destroy( &pp_contexts[i]->cond );
-            vlc_object_destroy( pp_contexts[i] );
+            vlc_object_release( pp_contexts[i] );
         }
 
         free( pp_contexts );
index 4995da3..9be5869 100644 (file)
@@ -152,7 +152,7 @@ static int Open( vlc_object_t * p_this )
     {
         if( p_sys->p_packetizer->fmt_in.p_extra )
             free( p_sys->p_packetizer->fmt_in.p_extra );
-        vlc_object_destroy( p_sys->p_packetizer );
+        vlc_object_release( p_sys->p_packetizer );
 
         msg_Err( p_demux, "cannot find flac packetizer" );
         return VLC_EGENERIC;
@@ -193,7 +193,7 @@ static void Close( vlc_object_t * p_this )
         free( p_sys->p_packetizer->fmt_in.p_extra );
 
     /* Delete the decoder */
-    vlc_object_destroy( p_sys->p_packetizer );
+    vlc_object_release( p_sys->p_packetizer );
     if( p_sys->p_meta )
         vlc_meta_Delete( p_sys->p_meta );
     free( p_sys );
index e965cd0..710aa6a 100644 (file)
@@ -398,7 +398,7 @@ error:
         vlc_object_kill( p_sys->p_timeout );
         vlc_thread_join( p_sys->p_timeout );
         vlc_object_detach( p_sys->p_timeout );
-        vlc_object_destroy( p_sys->p_timeout );
+        vlc_object_release( p_sys->p_timeout );
     }
     if( p_sys->scheduler ) delete p_sys->scheduler;
     if( p_sys->p_sdp ) free( p_sys->p_sdp );
@@ -439,7 +439,7 @@ static void Close( vlc_object_t *p_this )
         vlc_object_kill( p_sys->p_timeout );
         vlc_thread_join( p_sys->p_timeout );
         vlc_object_detach( p_sys->p_timeout );
-        vlc_object_destroy( p_sys->p_timeout );
+        vlc_object_release( p_sys->p_timeout );
     }
     if( p_sys->scheduler ) delete p_sys->scheduler;
     if( p_sys->p_sdp ) free( p_sys->p_sdp );
@@ -1033,7 +1033,7 @@ static int Play( demux_t *p_demux )
                                    VLC_THREAD_PRIORITY_LOW, VLC_TRUE ) )
             {
                 msg_Err( p_demux, "cannot spawn liveMedia timeout thread" );
-                vlc_object_destroy( p_sys->p_timeout );
+                vlc_object_release( p_sys->p_timeout );
             }
             msg_Dbg( p_demux, "spawned timeout thread" );
             vlc_object_attach( p_sys->p_timeout, p_demux );
index 344fdb4..e0ea9a7 100644 (file)
@@ -2693,7 +2693,7 @@ void demux_sys_t::StopUiThread()
     {
         vlc_object_kill( p_ev );
         vlc_thread_join( p_ev );
-        vlc_object_destroy( p_ev );
+        vlc_object_release( p_ev );
 
         p_ev = NULL;
 
index c1a7008..9d72bcc 100644 (file)
@@ -546,7 +546,7 @@ static void CloseBlending( intf_thread_t *p_intf )
                            p_intf->p_sys->p_blend->p_module );
 
         vlc_object_detach( p_intf->p_sys->p_blend );
-        vlc_object_destroy( p_intf->p_sys->p_blend );
+        vlc_object_release( p_intf->p_sys->p_blend );
     }
 }
 #endif
@@ -597,7 +597,7 @@ static void CloseTextRenderer( intf_thread_t *p_intf )
                            p_intf->p_sys->p_text->p_module );
 
         vlc_object_detach( p_intf->p_sys->p_text );
-        vlc_object_destroy( p_intf->p_sys->p_text );
+        vlc_object_release( p_intf->p_sys->p_text );
     }
 }
 #if 0
@@ -636,7 +636,7 @@ static int CloseScaling( intf_thread_t *p_intf )
                            p_intf->p_sys->p_scale->p_module );
 
         vlc_object_detach( p_intf->p_sys->p_scale );
-        vlc_object_destroy( p_intf->p_sys->p_scale );
+        vlc_object_release( p_intf->p_sys->p_scale );
     }
 }
 #endif
index 968d6d6..732f754 100644 (file)
@@ -116,7 +116,7 @@ Dialogs::~Dialogs()
         vlc_object_detach( m_pProvider );
 
         module_Unneed( m_pProvider, m_pModule );
-        vlc_object_destroy( m_pProvider );
+        vlc_object_release( m_pProvider );
     }
 
     /* Unregister callbacks */
@@ -170,7 +170,7 @@ bool Dialogs::init()
     if( m_pModule == NULL )
     {
         msg_Err( getIntf(), "no suitable dialogs provider found (hint: compile the wxWidgets plugin, and make sure it is loaded properly)" );
-        vlc_object_destroy( m_pProvider );
+        vlc_object_release( m_pProvider );
         m_pProvider = NULL;
         return false;
     }
index b550529..c27c937 100644 (file)
@@ -249,7 +249,7 @@ static void Unload( intf_thread_t *p_this )
     if( p_this->p_module )
         module_Unneed( p_this, p_this->p_module );
     vlc_mutex_destroy( &p_this->change_lock );
-    vlc_object_destroy( p_this );
+    vlc_object_release( p_this );
 }
 
 /*****************************************************************************
index 35f0d8c..99fa03e 100644 (file)
@@ -408,7 +408,7 @@ static int Create( vlc_object_t *p_this )
         }
         else
         {
-            vlc_object_destroy( p_fontbuilder );
+            vlc_object_release( p_fontbuilder );
         }
     }
     else
index 29c8ccf..fcccbe4 100644 (file)
@@ -936,7 +936,7 @@ gnutls_SessionClose (tls_server_t *p_server, tls_session_t *p_session)
     gnutls_deinit( p_sys->session );
 
     vlc_object_detach( p_session );
-    vlc_object_destroy( p_session );
+    vlc_object_release( p_session );
 
     free( p_sys );
 }
@@ -960,7 +960,7 @@ gnutls_ServerSessionPrepare( tls_server_t *p_server )
     p_session->p_sys = malloc( sizeof(struct tls_session_sys_t) );
     if( p_session->p_sys == NULL )
     {
-        vlc_object_destroy( p_session );
+        vlc_object_release( p_session );
         return NULL;
     }
 
@@ -1016,7 +1016,7 @@ gnutls_ServerSessionPrepare( tls_server_t *p_server )
 error:
     free( p_session->p_sys );
     vlc_object_detach( p_session );
-    vlc_object_destroy( p_session );
+    vlc_object_release( p_session );
     return NULL;
 }
 
index 127e59e..51cef4a 100644 (file)
@@ -111,7 +111,7 @@ static int Open( vlc_object_t *p_this )
     if( vlc_thread_create( p_gtk_main, "gtk_main", GtkMain,
                            VLC_THREAD_PRIORITY_LOW, VLC_TRUE ) )
     {
-        vlc_object_destroy( p_gtk_main );
+        vlc_object_release( p_gtk_main );
         i_refcount--;
         vlc_mutex_unlock( lock );
         return VLC_ETHREAD;
@@ -143,7 +143,7 @@ static void Close( vlc_object_t *p_this )
     gtk_main_quit();
     vlc_thread_join( p_gtk_main );
 
-    vlc_object_destroy( p_gtk_main );
+    vlc_object_release( p_gtk_main );
     p_gtk_main = NULL;
 
     vlc_mutex_unlock( lock );
index 7926433..61f4c92 100644 (file)
@@ -105,7 +105,7 @@ static int Open( vlc_object_t *p_this )
     if( vlc_thread_create( p_qte_main, "qte_main", QteMain,
                            VLC_THREAD_PRIORITY_LOW, VLC_TRUE ) )
     {
-        vlc_object_destroy( p_qte_main );
+        vlc_object_release( p_qte_main );
         i_refcount--;
         vlc_mutex_unlock( lock );
         return VLC_ETHREAD;
@@ -145,7 +145,7 @@ static void Close( vlc_object_t *p_this )
     msg_Dbg( p_this, "Detaching qte_main" );
     vlc_object_detach( p_qte_main );
 
-    vlc_object_destroy( p_qte_main );
+    vlc_object_release( p_qte_main );
     p_qte_main = NULL;
 
     vlc_mutex_unlock( lock );
index bfad740..2349da1 100644 (file)
@@ -181,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 */
@@ -313,7 +313,7 @@ static int Stress( vlc_object_t *p_this, char const *psz_cmd,
     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 );
@@ -393,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 );
@@ -428,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;
index db1e8dc..c025744 100644 (file)
@@ -308,7 +308,7 @@ static sout_stream_id_t * Add( sout_stream_t *p_stream, es_format_t *p_fmt )
     {
         msg_Err( p_stream, "cannot find decoder" );
         vlc_object_detach( p_sys->p_decoder );
-        vlc_object_destroy( p_sys->p_decoder );
+        vlc_object_release( p_sys->p_decoder );
         return NULL;
     }
 
@@ -417,7 +417,7 @@ static sout_stream_id_t * Add( sout_stream_t *p_stream, es_format_t *p_fmt )
                       "no video filter matching name \"%s\" found",
                       psz_name );
             vlc_object_detach( *pp_vfilter );
-            vlc_object_destroy( *pp_vfilter );
+            vlc_object_release( *pp_vfilter );
             p_sys->i_vfilters--;
         }
     }
@@ -448,7 +448,7 @@ static int Del( sout_stream_t *p_stream, sout_stream_id_t *id )
         if( p_sys->p_decoder->p_module )
             module_Unneed( p_sys->p_decoder, p_sys->p_decoder->p_module );
         vlc_object_detach( p_sys->p_decoder );
-        vlc_object_destroy( p_sys->p_decoder );
+        vlc_object_release( p_sys->p_decoder );
 
         for( i = 0; i < PICTURE_RING_SIZE; i++ )
         {
@@ -470,7 +470,7 @@ static int Del( sout_stream_t *p_stream, sout_stream_id_t *id )
         vlc_object_detach( *pp_vfilter );
         if( (*pp_vfilter)->p_module )
             module_Unneed( *pp_vfilter, (*pp_vfilter)->p_module );
-        vlc_object_destroy( *pp_vfilter );
+        vlc_object_release( *pp_vfilter );
     }
     free( p_sys->pp_vfilters );
 
index 7851498..aded619 100644 (file)
@@ -1210,7 +1210,7 @@ static int Del( sout_stream_t *p_stream, sout_stream_id_t *id )
     if( p_sys->b_export_sdp_file ) FileSetup( p_stream );
 
     vlc_object_detach( id );
-    vlc_object_destroy( id );
+    vlc_object_release( id );
     return VLC_SUCCESS;
 }
 
index 7b66499..ab067af 100644 (file)
@@ -472,7 +472,7 @@ static int Open( vlc_object_t *p_this )
     if( !p_sys->p_out )
     {
         msg_Err( p_stream, "cannot create chain" );
-        vlc_object_destroy( p_sys );
+        vlc_object_release( p_sys );
         return VLC_EGENERIC;
     }
 
@@ -884,7 +884,7 @@ static void Close( vlc_object_t * p_this )
     }
     if( p_sys->psz_osdenc ) free( p_sys->psz_osdenc );
 
-    vlc_object_destroy( p_sys );
+    vlc_object_release( p_sys );
 }
 
 struct sout_stream_id_t
@@ -1113,7 +1113,7 @@ static sout_stream_id_t *Add( sout_stream_t *p_stream, es_format_t *p_fmt )
     if( id->p_decoder )
     {
         vlc_object_detach( id->p_decoder );
-        vlc_object_destroy( id->p_decoder );
+        vlc_object_release( id->p_decoder );
         id->p_decoder = NULL;
     }
 
@@ -1121,7 +1121,7 @@ static sout_stream_id_t *Add( sout_stream_t *p_stream, es_format_t *p_fmt )
     {
         vlc_object_detach( id->p_encoder );
         es_format_Clean( &id->p_encoder->fmt_out );
-        vlc_object_destroy( id->p_encoder );
+        vlc_object_release( id->p_encoder );
         id->p_encoder = NULL;
     }
 
@@ -1157,7 +1157,7 @@ static int Del( sout_stream_t *p_stream, sout_stream_id_t *id )
     if( id->p_decoder )
     {
         vlc_object_detach( id->p_decoder );
-        vlc_object_destroy( id->p_decoder );
+        vlc_object_release( id->p_decoder );
         id->p_decoder = NULL;
     }
 
@@ -1165,7 +1165,7 @@ static int Del( sout_stream_t *p_stream, sout_stream_id_t *id )
     {
         vlc_object_detach( id->p_encoder );
         es_format_Clean( &id->p_encoder->fmt_out );
-        vlc_object_destroy( id->p_encoder );
+        vlc_object_release( id->p_encoder );
         id->p_encoder = NULL;
     }
     free( id );
@@ -1301,7 +1301,7 @@ static filter_t *transcode_audio_filter_new( sout_stream_t *p_stream,
     else
     {
         vlc_object_detach( p_filter );
-        vlc_object_destroy( p_filter );
+        vlc_object_release( p_filter );
         p_filter = 0;
     }
 
@@ -1525,14 +1525,14 @@ static void transcode_audio_close( sout_stream_id_t *id )
         vlc_object_detach( id->pp_filter[i] );
         if( id->pp_filter[i]->p_module )
             module_Unneed( id->pp_filter[i], id->pp_filter[i]->p_module );
-        vlc_object_destroy( id->pp_filter[i] );
+        vlc_object_release( id->pp_filter[i] );
     }
     for( i = 0; i < id->i_ufilter; i++ )
     {
         vlc_object_detach( id->pp_ufilter[i] );
         if( id->pp_ufilter[i]->p_module )
             module_Unneed( id->pp_ufilter[i], id->pp_ufilter[i]->p_module );
-        vlc_object_destroy( id->pp_ufilter[i] );
+        vlc_object_release( id->pp_ufilter[i] );
     }
 }
 
@@ -2110,7 +2110,7 @@ static void transcode_video_close( sout_stream_t *p_stream,
                                   id->pp_filter[i]->p_owner->pp_pics[j] );
         }
         free( id->pp_filter[i]->p_owner );
-        vlc_object_destroy( id->pp_filter[i] );
+        vlc_object_release( id->pp_filter[i] );
         id->pp_filter[i] = NULL;
     }
 
@@ -2128,7 +2128,7 @@ static void transcode_video_close( sout_stream_t *p_stream,
                                   id->pp_ufilter[i]->p_owner->pp_pics[j] );
         }
         free( id->pp_ufilter[i]->p_owner );
-        vlc_object_destroy( id->pp_ufilter[i] );
+        vlc_object_release( id->pp_ufilter[i] );
         id->pp_ufilter[i] = NULL;
     }
 }
@@ -2242,7 +2242,7 @@ static int transcode_video_process( sout_stream_t *p_stream,
                 {
                     msg_Dbg( p_stream, "no video filter found" );
                     vlc_object_detach( id->pp_filter[id->i_filter] );
-                    vlc_object_destroy( id->pp_filter[id->i_filter] );
+                    vlc_object_release( id->pp_filter[id->i_filter] );
                 }
             }
 
@@ -2302,7 +2302,7 @@ static int transcode_video_process( sout_stream_t *p_stream,
                 {
                     msg_Dbg( p_stream, "no video filter found" );
                     vlc_object_detach( id->pp_filter[id->i_filter] );
-                    vlc_object_destroy( id->pp_filter[id->i_filter] );
+                    vlc_object_release( id->pp_filter[id->i_filter] );
 
                     p_pic->pf_release( p_pic );
                     transcode_video_close( p_stream, id );
@@ -2341,7 +2341,7 @@ static int transcode_video_process( sout_stream_t *p_stream,
                 {
                     msg_Dbg( p_stream, "no video filter found" );
                     vlc_object_detach( id->pp_ufilter[id->i_ufilter] );
-                    vlc_object_destroy( id->pp_ufilter[id->i_ufilter] );
+                    vlc_object_release( id->pp_ufilter[id->i_ufilter] );
                     id->pp_ufilter[id->i_ufilter] = NULL;
                 }
             }
index 706b4ce..d9856e7 100644 (file)
@@ -51,7 +51,7 @@ CThread::~CThread(void)
       vlc_mutex_destroy( &m_TerminateLock );
       vlc_cond_destroy( &m_TerminateCond );
       vlc_object_detach(m_pAtmoThread);
-      vlc_object_destroy(m_pAtmoThread);
+      vlc_object_release(m_pAtmoThread);
   }
 }
 
index ab57e94..615fb0f 100644 (file)
@@ -942,7 +942,7 @@ static void Atmo_Shutdown(filter_t *p_filter)
                 VLC_FALSE ) )
             {
                 msg_Err( p_filter, "cannot create FadeToColorThread" );
-                vlc_object_destroy( p_sys->p_fadethread );
+                vlc_object_release( p_sys->p_fadethread );
                 p_sys->p_fadethread = NULL;
                 vlc_mutex_unlock( &p_sys->filter_lock );
 
@@ -953,7 +953,7 @@ static void Atmo_Shutdown(filter_t *p_filter)
                 /* wait for the thread... */
                 vlc_thread_join(p_sys->p_fadethread);
 
-                vlc_object_destroy(p_sys->p_fadethread);
+                vlc_object_release(p_sys->p_fadethread);
 
                 p_sys->p_fadethread = NULL;
             }
@@ -1841,7 +1841,7 @@ static void CheckAndStopFadeThread(filter_t *p_filter)
 
         vlc_thread_join(p_sys->p_fadethread);
 
-        vlc_object_destroy(p_sys->p_fadethread);
+        vlc_object_release(p_sys->p_fadethread);
         p_sys->p_fadethread = NULL;
     }
     vlc_mutex_unlock( &p_sys->filter_lock );
@@ -1897,7 +1897,7 @@ static int StateCallback( vlc_object_t *p_this, char const *psz_cmd,
                     VLC_FALSE) )
                 {
                     msg_Err( p_filter, "cannot create FadeToColorThread" );
-                    vlc_object_destroy( p_sys->p_fadethread );
+                    vlc_object_release( p_sys->p_fadethread );
                     p_sys->p_fadethread = NULL;
                 }
             }
index 49aad2d..24325fe 100644 (file)
@@ -417,7 +417,7 @@ static int Init( vout_thread_t *p_vout )
     {
         msg_Err( p_vout, "can't open blending filter, aborting" );
         vlc_object_detach( p_sys->p_blend );
-        vlc_object_destroy( p_sys->p_blend );
+        vlc_object_release( p_sys->p_blend );
         return VLC_EGENERIC;
     }
 
@@ -498,7 +498,7 @@ static void End( vout_thread_t *p_vout )
     if( p_sys->p_blend->p_module )
         module_Unneed( p_sys->p_blend, p_sys->p_blend->p_module );
     vlc_object_detach( p_sys->p_blend );
-    vlc_object_destroy( p_sys->p_blend );
+    vlc_object_release( p_sys->p_blend );
 }
 
 /*****************************************************************************
index 8b58811..acbc6be 100644 (file)
@@ -343,7 +343,7 @@ static int Init( vout_thread_t *p_vout )
         msg_Err( p_vout, "can't open internal opencv filter: %s", p_vout->p_sys->psz_inner_name );
         p_vout->p_sys->psz_inner_name = NULL;
         vlc_object_detach( p_sys->p_opencv );
-        vlc_object_destroy( p_sys->p_opencv );
+        vlc_object_release( p_sys->p_opencv );
         p_sys->p_opencv = NULL;
     }
 
@@ -389,7 +389,7 @@ static void End( vout_thread_t *p_vout )
         if( p_vout->p_sys->p_opencv->p_module )
             module_Unneed( p_vout->p_sys->p_opencv, p_vout->p_sys->p_opencv->p_module );
         vlc_object_detach( p_vout->p_sys->p_opencv );
-        vlc_object_destroy( p_vout->p_sys->p_opencv );
+        vlc_object_release( p_vout->p_sys->p_opencv );
         p_vout->p_sys->p_opencv = NULL;
     }
 
index b1e9a17..5d2a21b 100644 (file)
@@ -206,7 +206,7 @@ static int OpenVideo( vlc_object_t *p_this )
                            E_(EventThread), 0, 1 ) )
     {
         msg_Err( p_vout, "cannot create Vout EventThread" );
-        vlc_object_destroy( p_vout->p_sys->p_event );
+        vlc_object_release( p_vout->p_sys->p_event );
         p_vout->p_sys->p_event = NULL;
         goto error;
     }
@@ -282,7 +282,7 @@ static void CloseVideo( vlc_object_t *p_this )
         }
 
         vlc_thread_join( p_vout->p_sys->p_event );
-        vlc_object_destroy( p_vout->p_sys->p_event );
+        vlc_object_release( p_vout->p_sys->p_event );
     }
 
     vlc_mutex_destroy( &p_vout->p_sys->lock );
index e223246..915af9f 100644 (file)
@@ -281,7 +281,7 @@ static int OpenVideo( vlc_object_t *p_this )
                            E_(EventThread), 0, 1 ) )
     {
         msg_Err( p_vout, "cannot create Vout EventThread" );
-        vlc_object_destroy( p_vout->p_sys->p_event );
+        vlc_object_release( p_vout->p_sys->p_event );
         p_vout->p_sys->p_event = NULL;
         goto error;
     }
@@ -505,7 +505,7 @@ static void CloseVideo( vlc_object_t *p_this )
         }
 
         vlc_thread_join( p_vout->p_sys->p_event );
-        vlc_object_destroy( p_vout->p_sys->p_event );
+        vlc_object_release( p_vout->p_sys->p_event );
     }
 
     vlc_mutex_destroy( &p_vout->p_sys->lock );
index 45c2fbd..f7eec90 100644 (file)
@@ -138,7 +138,7 @@ static int OpenVideo( vlc_object_t *p_this )
                            E_(EventThread), 0, 1 ) )
     {
         msg_Err( p_vout, "cannot create Vout EventThread" );
-        vlc_object_destroy( p_vout->p_sys->p_event );
+        vlc_object_release( p_vout->p_sys->p_event );
         p_vout->p_sys->p_event = NULL;
         goto error;
     }
@@ -237,7 +237,7 @@ static void CloseVideo( vlc_object_t *p_this )
         }
 
         vlc_thread_join( p_vout->p_sys->p_event );
-        vlc_object_destroy( p_vout->p_sys->p_event );
+        vlc_object_release( p_vout->p_sys->p_event );
     }
 
     vlc_mutex_destroy( &p_vout->p_sys->lock );
index 5cf577f..f969312 100755 (executable)
@@ -251,7 +251,7 @@ static int OpenVideo ( vlc_object_t *p_this )
                            E_(EventThread), 0, 1 ) )
     {
         msg_Err( p_vout, "cannot create Vout EventThread" );
-        vlc_object_destroy( p_vout->p_sys->p_event );
+        vlc_object_release( p_vout->p_sys->p_event );
         p_vout->p_sys->p_event = NULL;
         goto error;
     }
@@ -325,7 +325,7 @@ static void CloseVideo ( vlc_object_t *p_this )
         }
 
         vlc_thread_join( p_vout->p_sys->p_event );
-        vlc_object_destroy( p_vout->p_sys->p_event );
+        vlc_object_release( p_vout->p_sys->p_event );
     }
     vlc_mutex_destroy( &p_vout->p_sys->lock );
 
index 72320ef..a8835a9 100644 (file)
@@ -302,7 +302,7 @@ static int CreateVout( vlc_object_t *p_this )
     {
         msg_Warn( p_vout, "No OpenGL provider found" );
         vlc_object_detach( p_sys->p_vout );
-        vlc_object_destroy( p_sys->p_vout );
+        vlc_object_release( p_sys->p_vout );
         return VLC_ENOOBJ;
     }
 
@@ -574,7 +574,7 @@ static void DestroyVout( vlc_object_t *p_this )
 
     module_Unneed( p_sys->p_vout, p_sys->p_vout->p_module );
     vlc_object_detach( p_sys->p_vout );
-    vlc_object_destroy( p_sys->p_vout );
+    vlc_object_release( p_sys->p_vout );
 
     free( p_sys );
 }
index 4b07300..17600e6 100644 (file)
@@ -191,7 +191,7 @@ static void Close ( vlc_object_t *p_this )
         CloseDisplay(p_vout);
 
         vlc_thread_join( p_vout->p_sys->p_event );
-        vlc_object_destroy( p_vout->p_sys->p_event );
+        vlc_object_release( p_vout->p_sys->p_event );
     }
 
 #ifdef NEED_QTE_MAIN
@@ -541,7 +541,7 @@ static int OpenDisplay( vout_thread_t *p_vout )
                             VLC_THREAD_PRIORITY_OUTPUT, VLC_TRUE) )
     {
         msg_Err( p_vout, "cannot create QT Embedded Thread" );
-        vlc_object_destroy( p_vout->p_sys->p_event );
+        vlc_object_release( p_vout->p_sys->p_event );
         p_vout->p_sys->p_event = NULL;
         return -1;
     }
index 7346947..c9672b8 100644 (file)
@@ -125,7 +125,7 @@ static int Open( vlc_object_t *p_this )
         msg_Err( p_filter, "cannot lauch galaktos thread" );
         if( p_thread->psz_title ) free( p_thread->psz_title );
         vlc_object_detach( p_thread );
-        vlc_object_destroy( p_thread );
+        vlc_object_release( p_thread );
         free( p_sys );
         return VLC_EGENERIC;
     }
@@ -229,7 +229,7 @@ static void Thread( vlc_object_t *p_this )
     {
         msg_Err( p_thread, "unable to initialize OpenGL" );
         vlc_object_detach( p_thread->p_opengl );
-        vlc_object_destroy( p_thread->p_opengl );
+        vlc_object_release( p_thread->p_opengl );
         return;
     }
 
@@ -270,7 +270,7 @@ static void Thread( vlc_object_t *p_this )
     /* Free the openGL provider */
     module_Unneed( p_thread->p_opengl, p_thread->p_module );
     vlc_object_detach( p_thread->p_opengl );
-    vlc_object_destroy( p_thread->p_opengl );
+    vlc_object_release( p_thread->p_opengl );
 }
 
 /*****************************************************************************
@@ -290,7 +290,7 @@ static void Close( vlc_object_t *p_this )
 
     /* Free data */
     vlc_object_detach( p_sys->p_thread );
-    vlc_object_destroy( p_sys->p_thread );
+    vlc_object_release( p_sys->p_thread );
 
     free( p_sys );
 }
index 03a424b..3148584 100644 (file)
@@ -177,7 +177,7 @@ static int Open( vlc_object_t *p_this )
     {
         msg_Err( p_filter, "no suitable vout module" );
         vlc_object_detach( p_thread );
-        vlc_object_destroy( p_thread );
+        vlc_object_release( p_thread );
         free( p_sys );
         return VLC_EGENERIC;
     }
@@ -200,7 +200,7 @@ static int Open( vlc_object_t *p_this )
         vlc_cond_destroy( &p_thread->wait );
         if( p_thread->psz_title ) free( p_thread->psz_title );
         vlc_object_detach( p_thread );
-        vlc_object_destroy( p_thread );
+        vlc_object_release( p_thread );
         free( p_sys );
         return VLC_EGENERIC;
     }
@@ -405,7 +405,7 @@ static void Close( vlc_object_t *p_this )
         block_Release( p_sys->p_thread->pp_blocks[p_sys->p_thread->i_blocks] );
     }
 
-    vlc_object_destroy( p_sys->p_thread );
+    vlc_object_release( p_sys->p_thread );
 
     free( p_sys );
 }
index d668742..fe18875 100644 (file)
@@ -80,7 +80,7 @@ void aout_Delete( aout_instance_t * p_aout )
     vlc_mutex_destroy( &p_aout->output_fifo_lock );
 
     /* Free structure. */
-    vlc_object_destroy( p_aout );
+    vlc_object_release( p_aout );
 }
 
 
index 9563f35..1362123 100644 (file)
@@ -58,7 +58,7 @@ static aout_filter_t * FindFilter( aout_instance_t * p_aout,
     if ( p_filter->p_module == NULL )
     {
         vlc_object_detach( p_filter );
-        vlc_object_destroy( p_filter );
+        vlc_object_release( p_filter );
         return NULL;
     }
 
@@ -122,7 +122,7 @@ static void ReleaseFilter( aout_filter_t * p_filter )
 {
     module_Unneed( p_filter, p_filter->p_module );
     vlc_object_detach( p_filter );
-    vlc_object_destroy( p_filter );
+    vlc_object_release( p_filter );
 }
 
 /*****************************************************************************
@@ -273,7 +273,7 @@ void aout_FiltersDestroyPipeline( aout_instance_t * p_aout,
     {
         module_Unneed( pp_filters[i], pp_filters[i]->p_module );
         vlc_object_detach( pp_filters[i] );
-        vlc_object_destroy( pp_filters[i] );
+        vlc_object_release( pp_filters[i] );
     }
 }
 
index 121b8f4..c233a6e 100644 (file)
@@ -313,7 +313,7 @@ int aout_InputNew( aout_instance_t * p_aout, aout_input_t * p_input )
                          psz_parser );
 
                 vlc_object_detach( p_filter );
-                vlc_object_destroy( p_filter );
+                vlc_object_release( p_filter );
 
                 psz_parser = psz_next;
                 continue;
@@ -332,7 +332,7 @@ int aout_InputNew( aout_instance_t * p_aout, aout_input_t * p_input )
 
                     module_Unneed( p_filter, p_filter->p_module );
                     vlc_object_detach( p_filter );
-                    vlc_object_destroy( p_filter );
+                    vlc_object_release( p_filter );
 
                     psz_parser = psz_next;
                     continue;
index 59fa336..ef6ead3 100644 (file)
@@ -88,7 +88,7 @@ mediacontrol_snapshot( mediacontrol_Instance *self,
 
     p_snapshot = ( snapshot_t* ) p_cache->p_private;
     vlc_object_unlock( p_cache );
-    vlc_object_destroy( p_cache );
+    vlc_object_release( p_cache );
 
     if( p_snapshot )
     {
index b8080b7..4121a84 100644 (file)
@@ -108,7 +108,7 @@ static access_t *access2_InternalNew( vlc_object_t *p_obj, const char *psz_acces
         free( p_access->psz_access );
         free( p_access->psz_path );
         free( p_access->psz_demux );
-        vlc_object_destroy( p_access );
+        vlc_object_release( p_access );
         return NULL;
     }
 
@@ -151,6 +151,6 @@ void access2_Delete( access_t *p_access )
         access2_Delete( p_access->p_source );
     }
 
-    vlc_object_destroy( p_access );
+    vlc_object_release( p_access );
 }
 
index 88ade6d..db14ff5 100644 (file)
@@ -183,7 +183,7 @@ decoder_t *input_DecoderNew( input_thread_t *p_input,
         DecoderUnsupportedCodec( p_dec, fmt->i_codec );
 
         DeleteDecoder( p_dec );
-        vlc_object_destroy( p_dec );
+        vlc_object_release( p_dec );
         return NULL;
     }
 
@@ -214,7 +214,7 @@ decoder_t *input_DecoderNew( input_thread_t *p_input,
             msg_Err( p_dec, "cannot spawn decoder thread" );
             module_Unneed( p_dec, p_dec->p_module );
             DeleteDecoder( p_dec );
-            vlc_object_destroy( p_dec );
+            vlc_object_release( p_dec );
             return NULL;
         }
     }
@@ -265,7 +265,7 @@ void input_DecoderDelete( decoder_t *p_dec )
     DeleteDecoder( p_dec );
 
     /* Delete the decoder */
-    vlc_object_destroy( p_dec );
+    vlc_object_release( p_dec );
 }
 
 /**
@@ -382,7 +382,7 @@ int input_DecoderSetCcState( decoder_t *p_dec, vlc_bool_t b_decode, int i_channe
         {
             DecoderUnsupportedCodec( p_dec, fcc[i_channel] );
             DeleteDecoder( p_cc );
-            vlc_object_destroy( p_cc );
+            vlc_object_release( p_cc );
             return VLC_EGENERIC;
         }
 
@@ -404,7 +404,7 @@ int input_DecoderSetCcState( decoder_t *p_dec, vlc_bool_t b_decode, int i_channe
             vlc_object_kill( p_cc );
             module_Unneed( p_cc, p_cc->p_module );
             DeleteDecoder( p_cc );
-            vlc_object_destroy( p_cc );
+            vlc_object_release( p_cc );
         }
     }
     return VLC_SUCCESS;
@@ -526,7 +526,7 @@ static decoder_t * CreateDecoder( input_thread_t *p_input,
             {
                 es_format_Clean( &p_dec->p_owner->p_packetizer->fmt_in );
                 vlc_object_detach( p_dec->p_owner->p_packetizer );
-                vlc_object_destroy( p_dec->p_owner->p_packetizer );
+                vlc_object_release( p_dec->p_owner->p_packetizer );
             }
         }
     }
@@ -1028,7 +1028,7 @@ static void DeleteDecoder( decoder_t * p_dec )
         es_format_Clean( &p_dec->p_owner->p_packetizer->fmt_in );
         es_format_Clean( &p_dec->p_owner->p_packetizer->fmt_out );
         vlc_object_detach( p_dec->p_owner->p_packetizer );
-        vlc_object_destroy( p_dec->p_owner->p_packetizer );
+        vlc_object_release( p_dec->p_owner->p_packetizer );
     }
 
     vlc_mutex_destroy( &p_dec->p_owner->lock_cc );
index 4bd3163..c5082c3 100644 (file)
@@ -174,7 +174,7 @@ demux_t *__demux2_New( vlc_object_t *p_obj,
         free( p_demux->psz_path );
         free( p_demux->psz_demux );
         free( p_demux->psz_access );
-        vlc_object_destroy( p_demux );
+        vlc_object_release( p_demux );
         return NULL;
     }
 
@@ -193,7 +193,7 @@ void demux2_Delete( demux_t *p_demux )
     free( p_demux->psz_demux );
     free( p_demux->psz_access );
 
-    vlc_object_destroy( p_demux );
+    vlc_object_release( p_demux );
 }
 
 /*****************************************************************************
@@ -340,7 +340,7 @@ stream_t *__stream_DemuxNew( vlc_object_t *p_obj, const char *psz_demux,
     if( ( p_sys->p_fifo = block_FifoNew( s ) ) == NULL )
     {
         msg_Err( s, "out of memory" );
-        vlc_object_destroy( s );
+        vlc_object_release( s );
         free( p_sys );
         return NULL;
     }
@@ -348,7 +348,7 @@ stream_t *__stream_DemuxNew( vlc_object_t *p_obj, const char *psz_demux,
     if( vlc_thread_create( s, "stream out", DStreamThread,
                            VLC_THREAD_PRIORITY_INPUT, VLC_FALSE ) )
     {
-        vlc_object_destroy( s );
+        vlc_object_release( s );
         free( p_sys );
         return NULL;
     }
@@ -381,7 +381,7 @@ void stream_DemuxDelete( stream_t *s )
     free( p_sys->psz_name );
     free( p_sys );
 
-    vlc_object_destroy( s );
+    vlc_object_release( s );
 }
 
 
index 153c928..68c00c5 100644 (file)
@@ -299,7 +299,7 @@ static void Destroy( input_thread_t *p_input, sout_instance_t **pp_sout )
             sout_DeleteInstance( priv->p_sout );
     }
 
-    vlc_object_destroy( p_input );
+    vlc_object_release( p_input );
     vlc_mutex_destroy( &priv->lock_control );
     free( priv );
 }
index 3496ab3..9978a13 100644 (file)
@@ -83,7 +83,7 @@ static void Delete( stream_t *s )
     if( !s->p_sys->i_preserve_memory ) free( s->p_sys->p_buffer );
     free( s->p_sys );
     vlc_object_detach( s );
-    vlc_object_destroy( s );
+    vlc_object_release( s );
 }
 
 /****************************************************************************
index f1a05eb..8c46964 100644 (file)
@@ -104,11 +104,11 @@ int input_MetaFetch( playlist_t *p_playlist, input_item_t *p_item )
     p_me->p_module = module_Need( p_me, "meta fetcher", 0, VLC_FALSE );
     if( !p_me->p_module )
     {
-        vlc_object_destroy( p_me );
+        vlc_object_release( p_me );
         return VLC_EGENERIC;
     }
     module_Unneed( p_me, p_me->p_module );
-    vlc_object_destroy( p_me );
+    vlc_object_release( p_me );
 
     input_item_SetMetaFetched( p_item, VLC_TRUE );
 
index c1458d2..34bc476 100644 (file)
@@ -423,7 +423,7 @@ error:
     free( psz_list );
     free( s->p_sys );
     vlc_object_detach( s );
-    vlc_object_destroy( s );
+    vlc_object_release( s );
     return NULL;
 }
 
@@ -452,7 +452,7 @@ static void AStreamDestroy( stream_t *s )
     }
 
     free( s->p_sys );
-    vlc_object_destroy( s );
+    vlc_object_release( s );
 }
 
 static void UStreamDestroy( stream_t *s )
index 027a55b..6a3caff 100644 (file)
@@ -137,7 +137,7 @@ vlm_t *__vlm_New ( vlc_object_t *p_this )
                            Manage, VLC_THREAD_PRIORITY_LOW, VLC_FALSE ) )
     {
         vlc_mutex_destroy( &p_vlm->lock );
-        vlc_object_destroy( p_vlm );
+        vlc_object_release( p_vlm );
         return NULL;
     }
 
@@ -198,7 +198,7 @@ void vlm_Delete( vlm_t *p_vlm )
 
     vlc_mutex_destroy( &p_vlm->lock );
 
-    vlc_object_destroy( p_vlm );
+    vlc_object_release( p_vlm );
     vlc_mutex_unlock( lockval.p_address );
 }
 
@@ -2367,7 +2367,7 @@ static int vlm_ControlMediaAdd( vlm_t *p_vlm, vlm_media_t *p_cfg, int64_t *p_id
         {
             msg_Err( p_vlm, "cannot find vod server" );
             vlc_object_detach( p_vlm->p_vod );
-            vlc_object_destroy( p_vlm->p_vod );
+            vlc_object_release( p_vlm->p_vod );
             p_vlm->p_vod = 0;
             return VLC_EGENERIC;
         }
@@ -2435,7 +2435,7 @@ static int vlm_ControlMediaDel( vlm_t *p_vlm, int64_t id )
     {
         module_Unneed( p_vlm->p_vod, p_vlm->p_vod->p_module );
         vlc_object_detach( p_vlm->p_vod );
-        vlc_object_destroy( p_vlm->p_vod );
+        vlc_object_release( p_vlm->p_vod );
         p_vlm->p_vod = NULL;
     }
     return VLC_SUCCESS;
index 7f5f9ef..41ef1a1 100644 (file)
@@ -71,7 +71,7 @@ void intf_InteractionDestroy( interaction_t *p_interaction )
         DialogDestroy( p_dialog );
         REMOVE_ELEM( p_interaction->pp_dialogs, p_interaction->i_dialogs, i );
     }
-    vlc_object_destroy( p_interaction );
+    vlc_object_release( p_interaction );
 }
 
 /**
index 1971268..797f47c 100644 (file)
@@ -101,7 +101,7 @@ intf_thread_t* __intf_Create( vlc_object_t *p_this, const char *psz_module,
     {
         msg_Err( p_intf, "no suitable interface module" );
         free( p_intf->psz_intf );
-        vlc_object_destroy( p_intf );
+        vlc_object_release( p_intf );
         return NULL;
     }
 
@@ -191,7 +191,7 @@ void intf_Destroy( intf_thread_t *p_intf )
     vlc_mutex_destroy( &p_intf->change_lock );
 
     /* Free structure */
-    vlc_object_destroy( p_intf );
+    vlc_object_release( p_intf );
 }
 
 
index dcd676e..e667d24 100644 (file)
@@ -1032,7 +1032,7 @@ int libvlc_InternalDestroy( libvlc_int_t *p_libvlc, vlc_bool_t b_release )
     vlc_mutex_destroy( &p_libvlc->timer_lock );
 
     if( b_release ) vlc_object_release( p_libvlc );
-    vlc_object_destroy( p_libvlc );
+    vlc_object_release( p_libvlc );
     p_libvlc = NULL;
 
     /* Stop thread system: last one out please shut the door!
index 5dea64d..e051f0c 100644 (file)
@@ -413,7 +413,6 @@ __vlc_mutex_init_recursive
 __vlc_object_alive
 __vlc_object_attach
 __vlc_object_create
-__vlc_object_destroy
 __vlc_object_detach
 __vlc_object_find
 __vlc_object_find_name
index 3eb2b2d..4fe105d 100644 (file)
@@ -108,7 +108,7 @@ void system_End( libvlc_int_t *p_this )
     be_app->PostMessage( REALLY_QUIT );
 
     vlc_thread_join( vlc_global()->p_appthread );
-    vlc_object_destroy( vlc_global()->p_appthread );
+    vlc_object_release( vlc_global()->p_appthread );
 
     free( vlc_global()->psz_vlcpath );
 }
index ae2414b..2b878c4 100644 (file)
@@ -50,7 +50,7 @@ void devices_ProbeCreate( vlc_object_t *p_this )
     if( p_probe->p_module == NULL )
     {
         msg_Err( p_this, "no devices probing module could be loaded" );
-        vlc_object_destroy( p_probe );
+        vlc_object_release( p_probe );
         return;
     }
 
index 973b126..8670dd1 100644 (file)
@@ -672,7 +672,7 @@ static void DeleteDecoder( decoder_t * p_dec )
     es_format_Clean( &p_dec->fmt_in );
     es_format_Clean( &p_dec->fmt_out );
 
-    vlc_object_destroy( p_dec );
+    vlc_object_release( p_dec );
     p_dec = NULL;
 }
 
@@ -755,7 +755,7 @@ static void DeleteEncoder( encoder_t * p_enc )
     es_format_Clean( &p_enc->fmt_in );
     es_format_Clean( &p_enc->fmt_out );
 
-    vlc_object_destroy( p_enc );
+    vlc_object_release( p_enc );
     p_enc = NULL;
 }
 
@@ -799,6 +799,6 @@ static void DeleteFilter( filter_t * p_filter )
     es_format_Clean( &p_filter->fmt_in );
     es_format_Clean( &p_filter->fmt_out );
 
-    vlc_object_destroy( p_filter );
+    vlc_object_release( p_filter );
     p_filter = NULL;
 }
index 8d1cac2..b191ee4 100644 (file)
@@ -92,6 +92,8 @@ static void           ListReplace   ( vlc_list_t *, vlc_object_t *, int );
 static int            CountChildren ( vlc_object_t *, int );
 static void           ListChildren  ( vlc_list_t *, vlc_object_t *, int );
 
+static void vlc_object_destroy( vlc_object_t *p_this );
+
 /*****************************************************************************
  * Local structure lock
  *****************************************************************************/
@@ -189,7 +191,7 @@ vlc_object_t *vlc_custom_create( vlc_object_t *p_this, size_t i_size,
         vlc_mutex_unlock( &structure_lock );
     }
 
-    p_priv->i_refcount = 0;
+    p_priv->i_refcount = 1;
     p_new->p_parent = NULL;
     p_new->pp_children = NULL;
     p_new->i_children = 0;
@@ -347,16 +349,15 @@ void * __vlc_object_create( vlc_object_t *p_this, int i_type )
 
 /**
  ****************************************************************************
- * Destroy a vlc object
+ * Destroy a vlc object (Internal)
  *
  * This function destroys an object that has been previously allocated with
  * vlc_object_create. The object's refcount must be zero and it must not be
  * attached to other objects in any way.
  *****************************************************************************/
-void __vlc_object_destroy( vlc_object_t *p_this )
+static void vlc_object_destroy( vlc_object_t *p_this )
 {
     vlc_object_internals_t *p_priv = vlc_internals( p_this );
-    int i_delay = 0;
 
     /* FIXME: ugly hack - we cannot use the message queue after
          * msg_Destroy(). */
@@ -366,18 +367,36 @@ void __vlc_object_destroy( vlc_object_t *p_this )
 
     if( p_this->i_children )
     {
+<<<<<<< .mine
+        fprintf( stderr,
+                  "ERROR: cannot delete object (%i, %s) with children\n",
+                  p_this->i_object_id, p_this->psz_object_name );
+        fflush(stderr);
+        abort();
+=======
         msg_Err( logger, "cannot delete object (%i, %s) with children" ,
                  p_this->i_object_id, p_this->psz_object_name );
         return;
+>>>>>>> .r25344
     }
 
     if( p_this->p_parent )
     {
+<<<<<<< .mine
+        fprintf( stderr,
+                  "ERROR: cannot delete object (%i, %s) with a parent\n",
+                  p_this->i_object_id, p_this->psz_object_name );
+        fflush(stderr);
+        abort();
+=======
         msg_Err( logger, "cannot delete object (%i, %s) with a parent",
                  p_this->i_object_id, p_this->psz_object_name );
         return;
+>>>>>>> .r25344
     }
 
+<<<<<<< .mine
+=======
     while( p_priv->i_refcount > 0 )
     {
         i_delay++;
@@ -408,6 +427,7 @@ void __vlc_object_destroy( vlc_object_t *p_this )
         msleep( 100000 );
     }
 
+>>>>>>> .r25344
     /* Destroy the associated variables, starting from the end so that
      * no memmove calls have to be done. */
     while( p_priv->i_vars )
@@ -423,10 +443,34 @@ void __vlc_object_destroy( vlc_object_t *p_this )
     if( p_this->i_object_type == VLC_OBJECT_GLOBAL )
     {
         libvlc_global_data_t *p_global = (libvlc_global_data_t *)p_this;
+
+        /* Remove ourselves */
+        int i_index = FindIndex( p_this, p_global->pp_objects,
+                             p_global->i_objects );
+        REMOVE_ELEM( p_global->pp_objects,
+                     p_global->i_objects, i_index );
+
+        /* Test for leaks */
+        if( p_global->i_objects > 0 )
+        {
+            int i;
+            for( i = 0; i < p_global->i_objects; i++ )
+            {
+                /* We are leaking this object */
+                fprintf( stderr,
+                      "ERROR: We are leaking object (id:%i, type:%s, name:%s)\n",
+                      p_global->pp_objects[i]->i_object_id,
+                      p_global->pp_objects[i]->psz_object_type,
+                      p_global->pp_objects[i]->psz_object_name );
+                fflush(stderr);
+            }
+            /* Strongly abort, cause we want these to be fixed */
+            abort();
+        }
+
         /* We are the global object ... no need to lock. */
         free( p_global->pp_objects );
         p_global->pp_objects = NULL;
-        p_global->i_objects--;
 
         vlc_mutex_destroy( &structure_lock );
     }
@@ -884,20 +928,37 @@ void __vlc_object_yield( vlc_object_t *p_this )
     vlc_mutex_unlock( &structure_lock );
 }
 
-static inline void Release( vlc_object_t *obj )
-{
-    assert( obj->p_internals->i_refcount > 0 );
-    obj->p_internals->i_refcount--;
-}
-
 /*****************************************************************************
  * decrement an object refcount
+ * And destroy the object if its refcount reach zero.
  *****************************************************************************/
 void __vlc_object_release( vlc_object_t *p_this )
 {
+    vlc_bool_t b_should_destroy;
+
     vlc_mutex_lock( &structure_lock );
-    Release( p_this );
+
+    assert( p_this->p_internals->i_refcount > 0 );
+    p_this->p_internals->i_refcount--;
+    b_should_destroy = (p_this->p_internals->i_refcount == 0);
+
     vlc_mutex_unlock( &structure_lock );
+
+    if( b_should_destroy )
+        vlc_object_destroy( p_this );
+}
+
+/* Version without the lock */
+static void vlc_object_release_locked( vlc_object_t *p_this )
+{
+    vlc_bool_t b_should_destroy;
+
+    assert( p_this->p_internals->i_refcount > 0 );
+    p_this->p_internals->i_refcount--;
+    b_should_destroy = (p_this->p_internals->i_refcount == 0);
+
+    if( b_should_destroy )
+        vlc_object_destroy( p_this );
 }
 
 /**
@@ -1221,7 +1282,7 @@ void vlc_list_release( vlc_list_t *p_list )
     vlc_mutex_lock( &structure_lock );
     for( i_index = 0; i_index < p_list->i_count; i_index++ )
     {
-        Release( p_list->p_values[i_index].p_object );
+        vlc_object_release_locked( p_list->p_values[i_index].p_object );
     }
     vlc_mutex_unlock( &structure_lock );
 
index 0031fa7..5ce61f0 100644 (file)
@@ -251,7 +251,7 @@ int __vlc_threads_end( vlc_object_t *p_this )
     if( i_initializations == 0 )
     {
         i_status = VLC_THREADS_UNINITIALIZED;
-        vlc_object_destroy( p_root );
+        vlc_object_release( p_root );
     }
 
 #if defined( UNDER_CE )
index 513888f..ad806c1 100644 (file)
@@ -1142,7 +1142,7 @@ void update_CheckReal( update_check_thread_t *p_uct )
     if( p_uct->pf_callback )
         (p_uct->pf_callback)( p_uct->p_data, b_ret );
 
-    vlc_object_destroy( p_uct );
+    vlc_object_release( p_uct );
 }
 
 /**
@@ -1430,7 +1430,7 @@ end:
     free( p_buffer );
     free( psz_size );
 
-    vlc_object_destroy( p_udt );
+    vlc_object_release( p_udt );
 }
 
 #endif
index 11243a5..f49c7ee 100644 (file)
@@ -46,7 +46,7 @@ xml_t *__xml_Create( vlc_object_t *p_this )
     if( !p_xml->p_module )
     {
         vlc_object_detach( p_xml );
-        vlc_object_destroy( p_xml );
+        vlc_object_release( p_xml );
         msg_Err( p_this, "XML provider not found" );
         return NULL;
     }
@@ -61,5 +61,5 @@ void xml_Delete( xml_t *p_xml )
 {
     module_Unneed( p_xml, p_xml->p_module );
     vlc_object_detach( p_xml );
-    vlc_object_destroy( p_xml );
+    vlc_object_release( p_xml );
 }
index a42e1b0..b505d1c 100644 (file)
@@ -234,11 +234,11 @@ void __module_EndBank( vlc_object_t *p_this )
 
             /* We just free the module by hand. Niahahahahaha. */
             vlc_object_detach( p_next );
-            vlc_object_destroy( p_next );
+            vlc_object_release( p_next );
         }
     }
 
-    vlc_object_destroy( p_libvlc_global->p_module_bank );
+    vlc_object_release( p_libvlc_global->p_module_bank );
     p_libvlc_global->p_module_bank = NULL;
 }
 
@@ -1260,7 +1260,7 @@ static module_t * AllocatePlugin( vlc_object_t * p_this, char * psz_file )
     if( module_Call( p_module ) != 0 )
     {
         /* We couldn't call module_init() */
-        vlc_object_destroy( p_module );
+        vlc_object_release( p_module );
         module_Unload( handle );
         return NULL;
     }
@@ -1362,7 +1362,7 @@ static int AllocateBuiltinModule( vlc_object_t * p_this,
         /* With a well-written module we shouldn't have to print an
          * additional error message here, but just make sure. */
         msg_Err( p_this, "failed calling entry point in builtin module" );
-        vlc_object_destroy( p_module );
+        vlc_object_release( p_module );
         return -1;
     }
 
@@ -1406,11 +1406,11 @@ static int DeleteModule( module_t * p_module, vlc_bool_t b_detach )
     {
         vlc_object_t *p_this = p_module->pp_children[0];
         vlc_object_detach( p_this );
-        vlc_object_destroy( p_this );
+        vlc_object_release( p_this );
     }
 
     config_Free( p_module );
-    vlc_object_destroy( p_module );
+    vlc_object_release( p_module );
     p_module = NULL;
     return 0;
 }
index 3d333e3..d8c8618 100644 (file)
@@ -1124,7 +1124,7 @@ error:
     {
         vlc_object_release( httpd );
         vlc_object_detach( httpd );
-        vlc_object_destroy( httpd );
+        vlc_object_release( httpd );
     }
     vlc_mutex_unlock( lockval.p_address );
 
@@ -1132,7 +1132,7 @@ error:
     {
         net_ListenClose( host->fds );
         vlc_mutex_destroy( &host->lock );
-        vlc_object_destroy( host );
+        vlc_object_release( host );
     }
 
     if( p_tls != NULL )
@@ -1188,14 +1188,14 @@ void httpd_HostDelete( httpd_host_t *host )
     free( host->psz_hostname );
 
     vlc_mutex_destroy( &host->lock );
-    vlc_object_destroy( host );
+    vlc_object_release( host );
 
     vlc_object_release( httpd );
     if( httpd->i_host <= 0 )
     {
         msg_Dbg( httpd, "no host left, stopping httpd" );
         vlc_object_detach( httpd );
-        vlc_object_destroy( httpd );
+        vlc_object_release( httpd );
     }
     vlc_mutex_unlock( lockval.p_address );
 }
index 385e99e..b82d9e5 100644 (file)
@@ -73,7 +73,7 @@ tls_ServerCreate (vlc_object_t *obj, const char *cert_path,
     if (srv->p_module == NULL)
     {
         msg_Err (srv, "TLS server plugin not available");
-        vlc_object_destroy (srv);
+        vlc_object_release (srv);
         return NULL;
     }
 
@@ -94,7 +94,7 @@ void tls_ServerDelete (tls_server_t *srv)
 
     module_Unneed (srv, srv->p_module);
     vlc_object_detach (srv);
-    vlc_object_destroy (srv);
+    vlc_object_release (srv);
 }
 
 
@@ -189,7 +189,7 @@ tls_ClientCreate (vlc_object_t *obj, int fd, const char *psz_hostname)
     if (cl->p_module == NULL)
     {
         msg_Err (cl, "TLS client plugin not available");
-        vlc_object_destroy (cl);
+        vlc_object_release (cl);
         return NULL;
     }
 
@@ -208,7 +208,7 @@ tls_ClientCreate (vlc_object_t *obj, int fd, const char *psz_hostname)
     msg_Err (cl, "TLS client session handshake error");
 
     module_Unneed (cl, cl->p_module);
-    vlc_object_destroy (cl);
+    vlc_object_release (cl);
     return NULL;
 }
 
@@ -224,5 +224,5 @@ void tls_ClientDelete (tls_session_t *cl)
 
     module_Unneed (cl, cl->p_module);
     vlc_object_detach (cl);
-    vlc_object_destroy (cl);
+    vlc_object_release (cl);
 }
index 0afb053..b890244 100644 (file)
@@ -118,7 +118,7 @@ static void osd_ParserUnload( osd_menu_t *p_menu )
         module_Unneed( p_menu, p_menu->p_parser );
 
     vlc_object_detach( p_menu );
-    vlc_object_destroy( p_menu );
+    vlc_object_release( p_menu );
 }
 
 /**
@@ -216,7 +216,7 @@ error:
         free( p_osd->psz_file );
 
     vlc_object_detach( p_osd );
-    vlc_object_destroy( p_osd );
+    vlc_object_release( p_osd );
     vlc_mutex_unlock( lockval.p_address );
     return NULL;
 }
index e44d127..05858a8 100644 (file)
@@ -180,7 +180,7 @@ void playlist_Destroy( playlist_t *p_playlist )
 
     vlc_mutex_destroy( &p_playlist->gc_lock );
     vlc_object_detach( p_playlist );
-    vlc_object_destroy( p_playlist );
+    vlc_object_release( p_playlist );
 }
 
 /* Destroy remaining objects */
index e3e787f..3c892eb 100644 (file)
@@ -77,7 +77,7 @@ services_discovery_Create ( vlc_object_t * p_super, const char * psz_module_name
     if( p_sd->p_module == NULL )
     {
         msg_Err( p_super, "no suitable services discovery module" );
-        vlc_object_destroy( p_sd );
+        vlc_object_release( p_sd );
         return NULL;
     }
     p_sd->psz_module = strdup( psz_module_name );
@@ -98,7 +98,7 @@ void services_discovery_Destroy ( services_discovery_t * p_sd )
     free( p_sd->psz_localized_name );
 
     vlc_object_detach( p_sd );
-    vlc_object_destroy( p_sd );
+    vlc_object_release( p_sd );
 }
 
 /***********************************************************************
@@ -111,7 +111,7 @@ int services_discovery_Start ( services_discovery_t * p_sd )
                               VLC_THREAD_PRIORITY_LOW, VLC_FALSE))
     {
         msg_Err( p_sd, "cannot create services discovery thread" );
-        vlc_object_destroy( p_sd );
+        vlc_object_release( p_sd );
         return VLC_EGENERIC;
     }
     return VLC_SUCCESS;
index ad9242d..caadd8c 100644 (file)
@@ -74,7 +74,7 @@ void __playlist_ThreadCreate( vlc_object_t *p_parent )
     if( !p_playlist->p_preparse )
     {
         msg_Err( p_playlist, "unable to create preparser" );
-        vlc_object_destroy( p_playlist );
+        vlc_object_release( p_playlist );
         return;
     }
     p_playlist->p_preparse->i_waiting = 0;
@@ -86,7 +86,7 @@ void __playlist_ThreadCreate( vlc_object_t *p_parent )
     {
         msg_Err( p_playlist, "cannot spawn preparse thread" );
         vlc_object_detach( p_playlist->p_preparse );
-        vlc_object_destroy( p_playlist->p_preparse );
+        vlc_object_release( p_playlist->p_preparse );
         return;
     }
 
@@ -96,7 +96,7 @@ void __playlist_ThreadCreate( vlc_object_t *p_parent )
     if( !p_playlist->p_fetcher )
     {
         msg_Err( p_playlist, "unable to create secondary preparser" );
-        vlc_object_destroy( p_playlist );
+        vlc_object_release( p_playlist );
         return;
     }
     p_playlist->p_fetcher->i_waiting = 0;
@@ -114,7 +114,7 @@ void __playlist_ThreadCreate( vlc_object_t *p_parent )
     {
         msg_Err( p_playlist, "cannot spawn secondary preparse thread" );
         vlc_object_detach( p_playlist->p_fetcher );
-        vlc_object_destroy( p_playlist->p_fetcher );
+        vlc_object_release( p_playlist->p_fetcher );
         return;
     }
 
@@ -123,7 +123,7 @@ void __playlist_ThreadCreate( vlc_object_t *p_parent )
                            VLC_THREAD_PRIORITY_LOW, VLC_TRUE ) )
     {
         msg_Err( p_playlist, "cannot spawn playlist thread" );
-        vlc_object_destroy( p_playlist );
+        vlc_object_release( p_playlist );
         return;
     }
 
@@ -152,7 +152,7 @@ int playlist_ThreadDestroy( playlist_t * p_playlist )
         vlc_thread_join( p_playlist->p_preparse );
         free( p_playlist->p_preparse->pp_waiting );
         vlc_object_detach( p_playlist->p_preparse );
-        vlc_object_destroy( p_playlist->p_preparse );
+        vlc_object_release( p_playlist->p_preparse );
     }
 
     // Kill meta fetcher
@@ -162,7 +162,7 @@ int playlist_ThreadDestroy( playlist_t * p_playlist )
         vlc_thread_join( p_playlist->p_fetcher );
         free( p_playlist->p_fetcher->p_waiting );
         vlc_object_detach( p_playlist->p_fetcher );
-        vlc_object_destroy( p_playlist->p_fetcher );
+        vlc_object_release( p_playlist->p_fetcher );
     }
 
     // Wait for thread to complete
index 4c183cc..c1bb2da 100644 (file)
@@ -187,7 +187,7 @@ int announce_HandlerDestroy( announce_handler_t *p_announce )
     }
 
     /* Free the structure */
-    vlc_object_destroy( p_announce );
+    vlc_object_release( p_announce );
 
     return VLC_SUCCESS;
 }
index 9529c5f..c0caf43 100644 (file)
@@ -185,7 +185,7 @@ void announce_SAPHandlerDestroy( sap_handler_t *p_sap )
     }
 
     /* Free the structure */
-    vlc_object_destroy( p_sap );
+    vlc_object_release( p_sap );
 }
 
 /**
index a59b02f..c7da6fe 100644 (file)
@@ -120,7 +120,7 @@ sout_instance_t *__sout_NewInstance( vlc_object_t *p_parent, char * psz_dest )
         FREENULL( p_sout->psz_chain );
 
         vlc_object_detach( p_sout );
-        vlc_object_destroy( p_sout );
+        vlc_object_release( p_sout );
         return NULL;
     }
 
@@ -148,7 +148,7 @@ void sout_DeleteInstance( sout_instance_t * p_sout )
     vlc_mutex_destroy( &p_sout->lock );
 
     /* *** free structure *** */
-    vlc_object_destroy( p_sout );
+    vlc_object_release( p_sout );
 }
 
 /*****************************************************************************
@@ -333,7 +333,7 @@ sout_access_out_t *sout_AccessOutNew( sout_instance_t *p_sout,
         free( p_access->psz_access );
         free( p_access->psz_path );
         vlc_object_detach( p_access );
-        vlc_object_destroy( p_access );
+        vlc_object_release( p_access );
         return( NULL );
     }
 
@@ -355,7 +355,7 @@ void sout_AccessOutDelete( sout_access_out_t *p_access )
 
     free( p_access->psz_path );
 
-    vlc_object_destroy( p_access );
+    vlc_object_release( p_access );
 }
 
 /*****************************************************************************
@@ -446,7 +446,7 @@ sout_mux_t * sout_MuxNew( sout_instance_t *p_sout, char *psz_mux,
         FREENULL( p_mux->psz_mux );
 
         vlc_object_detach( p_mux );
-        vlc_object_destroy( p_mux );
+        vlc_object_release( p_mux );
         return NULL;
     }
 
@@ -505,7 +505,7 @@ void sout_MuxDelete( sout_mux_t *p_mux )
 
     config_ChainDestroy( p_mux->p_cfg );
 
-    vlc_object_destroy( p_mux );
+    vlc_object_release( p_mux );
 }
 
 /*****************************************************************************
@@ -856,7 +856,7 @@ void sout_StreamDelete( sout_stream_t *p_stream )
     config_ChainDestroy( p_stream->p_cfg );
 
     msg_Dbg( p_stream, "destroying chain done" );
-    vlc_object_destroy( p_stream );
+    vlc_object_release( p_stream );
 }
 
 static char *_sout_stream_url_to_chain( vlc_object_t *p_this, char *psz_url )
index edb78f1..b17bce3 100644 (file)
@@ -405,7 +405,7 @@ vout_thread_t * __vout_Create( vlc_object_t *p_parent, video_format_t *p_fmt )
     {
         msg_Err( p_vout, "no suitable vout module" );
         vlc_object_detach( p_vout );
-        vlc_object_destroy( p_vout );
+        vlc_object_release( p_vout );
         return NULL;
     }
 
@@ -459,7 +459,7 @@ vout_thread_t * __vout_Create( vlc_object_t *p_parent, video_format_t *p_fmt )
         msg_Err( p_vout, "out of memory" );
         module_Unneed( p_vout, p_vout->p_module );
         vlc_object_detach( p_vout );
-        vlc_object_destroy( p_vout );
+        vlc_object_release( p_vout );
         return NULL;
     }
 
@@ -472,7 +472,7 @@ vout_thread_t * __vout_Create( vlc_object_t *p_parent, video_format_t *p_fmt )
         vlc_thread_join( p_vout );
 
         vlc_object_detach( p_vout );
-        vlc_object_destroy( p_vout );
+        vlc_object_release( p_vout );
         return NULL;
     }
 
@@ -503,7 +503,7 @@ void vout_Destroy( vout_thread_t *p_vout )
     config_ChainDestroy( p_vout->p_cfg );
 
     /* Free structure */
-    vlc_object_destroy( p_vout );
+    vlc_object_release( p_vout );
 #ifndef __APPLE__
     /* This is a dirty hack for mostly Linux, where there is no way to get the GUI
        back if you closed it while playing video. This is solved in Mac OS X,
@@ -1001,7 +1001,7 @@ static void RunThread( vout_thread_t *p_vout)
                     msg_Err( p_vout, "no video filter found (%s)",
                              p_vout->psz_vfilters[i] );
                     vlc_object_detach( p_vfilter );
-                    vlc_object_destroy( p_vfilter );
+                    vlc_object_release( p_vfilter );
                 }
             }
             p_vout->b_vfilter_change = VLC_FALSE;
@@ -1451,7 +1451,7 @@ static void SuxorRestartVideoES( suxor_thread_t *p_this )
 
     vlc_object_release( p_this->p_input );
 
-    vlc_object_destroy( p_this );
+    vlc_object_release( p_this );
 }
 
 /*****************************************************************************
@@ -1629,7 +1629,7 @@ static void RemoveVideoFilters2( vout_thread_t *p_vout )
         }
 
         free( p_vout->pp_vfilters[i]->p_owner );
-        vlc_object_destroy( p_vout->pp_vfilters[i] );
+        vlc_object_release( p_vout->pp_vfilters[i] );
     }
     p_vout->i_vfilters = 0;
 }
index 5a55efd..8e1f9ce 100644 (file)
@@ -162,7 +162,7 @@ int spu_ParseChain( spu_t *p_spu )
             msg_Dbg( p_spu, "no sub filter found" );
             config_ChainDestroy( p_spu->pp_filter[p_spu->i_filter]->p_cfg );
             vlc_object_detach( p_spu->pp_filter[p_spu->i_filter] );
-            vlc_object_destroy( p_spu->pp_filter[p_spu->i_filter] );
+            vlc_object_release( p_spu->pp_filter[p_spu->i_filter] );
         }
 
         if( p_spu->i_filter >= 10 )
@@ -203,7 +203,7 @@ void spu_Destroy( spu_t *p_spu )
             module_Unneed( p_spu->p_blend, p_spu->p_blend->p_module );
 
         vlc_object_detach( p_spu->p_blend );
-        vlc_object_destroy( p_spu->p_blend );
+        vlc_object_release( p_spu->p_blend );
     }
 
     if( p_spu->p_text )
@@ -212,7 +212,7 @@ void spu_Destroy( spu_t *p_spu )
             module_Unneed( p_spu->p_text, p_spu->p_text->p_module );
 
         vlc_object_detach( p_spu->p_text );
-        vlc_object_destroy( p_spu->p_text );
+        vlc_object_release( p_spu->p_text );
     }
 
     if( p_spu->p_scale )
@@ -221,13 +221,13 @@ void spu_Destroy( spu_t *p_spu )
             module_Unneed( p_spu->p_scale, p_spu->p_scale->p_module );
 
         vlc_object_detach( p_spu->p_scale );
-        vlc_object_destroy( p_spu->p_scale );
+        vlc_object_release( p_spu->p_scale );
     }
 
     spu_DeleteChain( p_spu );
 
     vlc_mutex_destroy( &p_spu->subpicture_lock );
-    vlc_object_destroy( p_spu );
+    vlc_object_release( p_spu );
 }
 
 static void spu_DeleteChain( spu_t *p_spu )
@@ -241,7 +241,7 @@ static void spu_DeleteChain( spu_t *p_spu )
         free( p_spu->pp_filter[p_spu->i_filter]->p_owner );
         config_ChainDestroy( p_spu->pp_filter[p_spu->i_filter]->p_cfg );
         vlc_object_detach( p_spu->pp_filter[p_spu->i_filter] );
-        vlc_object_destroy( p_spu->pp_filter[p_spu->i_filter] );
+        vlc_object_release( p_spu->pp_filter[p_spu->i_filter] );
     }
 }