[vlc-devel] commit: input: DestroyThread()' s content should happen in the input destructor. (Pierre d'Herbemont )

git version control git at videolan.org
Sat Mar 29 02:23:03 CET 2008


vlc | branch: master | Pierre d'Herbemont <pdherbemont at videolan.org> | Sat Mar 29 00:22:21 2008 +0100| [93ed4c42f8be63c4fd5e3d703c0655744e52b0a3]

input: DestroyThread()'s content should happen in the input destructor.

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

 src/video_output/video_output.c |   39 +++++++++++----------------------------
 1 files changed, 11 insertions(+), 28 deletions(-)

diff --git a/src/video_output/video_output.c b/src/video_output/video_output.c
index 81efa98..78fadda 100644
--- a/src/video_output/video_output.c
+++ b/src/video_output/video_output.c
@@ -66,7 +66,6 @@ static int      InitThread        ( vout_thread_t * );
 static void     RunThread         ( vout_thread_t * );
 static void     ErrorThread       ( vout_thread_t * );
 static void     EndThread         ( vout_thread_t * );
-static void     DestroyThread     ( vout_thread_t * );
 
 static void     AspectRatio       ( int, int *, int * );
 static int      BinaryLog         ( uint32_t );
@@ -492,6 +491,17 @@ static void vout_Destructor( vlc_object_t * p_this )
 {
     vout_thread_t *p_vout = (vout_thread_t *)p_this;
 
+    /* Destroy the locks */
+    vlc_mutex_destroy( &p_vout->picture_lock );
+    vlc_mutex_destroy( &p_vout->change_lock );
+    vlc_mutex_destroy( &p_vout->vfilter_lock );
+
+    /* Release the module */
+    if( p_vout->p_module )
+    {
+        module_Unneed( p_vout, p_vout->p_module );
+    }
+
     free( p_vout->psz_filter_chain );
 
     config_ChainDestroy( p_vout->p_cfg );
@@ -752,11 +762,7 @@ static void RunThread( vout_thread_t *p_vout)
     vlc_thread_ready( p_vout );
 
     if( p_vout->b_error )
-    {
-        /* Destroy thread structures allocated by Create and InitThread */
-        DestroyThread( p_vout );
         return;
-    }
 
     if( p_vout->b_title_show )
         DisplayTitleOnOSD( p_vout );
@@ -1213,9 +1219,6 @@ static void RunThread( vout_thread_t *p_vout)
 
     /* End of thread */
     EndThread( p_vout );
-
-    /* Destroy thread structures allocated by CreateThread */
-    DestroyThread( p_vout );
 }
 
 /*****************************************************************************
@@ -1283,26 +1286,6 @@ static void EndThread( vout_thread_t *p_vout )
     vlc_mutex_unlock( &p_vout->change_lock );
 }
 
-/*****************************************************************************
- * DestroyThread: thread destruction
- *****************************************************************************
- * This function is called when the thread ends. It frees all ressources
- * allocated by CreateThread. Status is available at this stage.
- *****************************************************************************/
-static void DestroyThread( vout_thread_t *p_vout )
-{
-    /* Destroy the locks */
-    vlc_mutex_destroy( &p_vout->picture_lock );
-    vlc_mutex_destroy( &p_vout->change_lock );
-    vlc_mutex_destroy( &p_vout->vfilter_lock );
-
-    /* Release the module */
-    if( p_vout && p_vout->p_module )
-    {
-        module_Unneed( p_vout, p_vout->p_module );
-    }
-}
-
 /* following functions are local */
 
 static int ReduceHeight( int i_ratio )




More information about the vlc-devel mailing list