[vlc-devel] commit: Fixed spu destruction order. (Laurent Aimar )

git version control git at videolan.org
Fri Oct 10 01:45:21 CEST 2008


vlc | branch: 0.9-bugfix | Laurent Aimar <fenrir at videolan.org> | Fri Oct 10 00:17:45 2008 +0200| [7f41e3edc9cf0bd1c5ef646615005654630b2e7b] | committer: Derk-Jan Hartman 

Fixed spu destruction order.

It should fix a potential segfault when the vout is closed.

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

 src/video_output/video_output.c |   10 ++++++----
 1 files changed, 6 insertions(+), 4 deletions(-)

diff --git a/src/video_output/video_output.c b/src/video_output/video_output.c
index c3ed091..b41aad2 100644
--- a/src/video_output/video_output.c
+++ b/src/video_output/video_output.c
@@ -449,9 +449,7 @@ vout_thread_t * __vout_Create( vlc_object_t *p_parent, video_format_t *p_fmt )
     if( p_vout->p_module == NULL )
     {
         msg_Err( p_vout, "no suitable vout module" );
-        // FIXME it's ugly but that's exactly the function that need to be called.
-        EndThread( p_vout );
-        vlc_object_detach( p_vout );
+        vlc_object_set_destructor( p_vout, vout_Destructor );
         vlc_object_release( p_vout );
         return NULL;
     }
@@ -504,6 +502,8 @@ vout_thread_t * __vout_Create( vlc_object_t *p_parent, video_format_t *p_fmt )
                            VLC_THREAD_PRIORITY_OUTPUT, true ) )
     {
         module_Unneed( p_vout, p_vout->p_module );
+        p_vout->p_module = NULL;
+        vlc_object_set_destructor( p_vout, vout_Destructor );
         vlc_object_release( p_vout );
         return NULL;
     }
@@ -546,6 +546,9 @@ static void vout_Destructor( vlc_object_t * p_this )
     /* Make sure the vout was stopped first */
     assert( !p_vout->p_module );
 
+    /* */
+    spu_Destroy( p_vout->p_spu );
+
     /* Destroy the locks */
     vlc_mutex_destroy( &p_vout->picture_lock );
     vlc_mutex_destroy( &p_vout->change_lock );
@@ -1248,7 +1251,6 @@ static void EndThread( vout_thread_t *p_vout )
 
     /* Destroy subpicture unit */
     spu_Attach( p_vout->p_spu, VLC_OBJECT(p_vout), false );
-    spu_Destroy( p_vout->p_spu );
 
     /* Destroy the video filters2 */
     filter_chain_Delete( p_vout->p_vf2_chain );




More information about the vlc-devel mailing list