[vlc-devel] commit: Fixed spu_t attach/detach sequence. (Laurent Aimar )

git version control git at videolan.org
Wed Apr 8 23:32:38 CEST 2009


vlc | branch: master | Laurent Aimar <fenrir at videolan.org> | Wed Apr  8 23:30:31 2009 +0200| [cf105ef4d435ffbba149b27a7486cfe81b765acb] | committer: Laurent Aimar 

Fixed spu_t attach/detach sequence.

It should fix #2622 (segfault with vout-filter).

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

 src/video_output/video_output.c     |    9 ++++++---
 src/video_output/vout_subpictures.c |    3 ++-
 2 files changed, 8 insertions(+), 4 deletions(-)

diff --git a/src/video_output/video_output.c b/src/video_output/video_output.c
index 4677358..8dd1d60 100644
--- a/src/video_output/video_output.c
+++ b/src/video_output/video_output.c
@@ -271,10 +271,11 @@ vout_thread_t *__vout_Request( vlc_object_t *p_this, vout_thread_t *p_vout,
         {
             msg_Dbg( p_this, "reusing provided vout" );
 
-            spu_Attach( p_vout->p_spu, p_this, true );
-
+            spu_Attach( p_vout->p_spu, VLC_OBJECT(p_vout), false );
             vlc_object_detach( p_vout );
+
             vlc_object_attach( p_vout, p_this );
+            spu_Attach( p_vout->p_spu, VLC_OBJECT(p_vout), true );
         }
     }
 
@@ -418,13 +419,15 @@ vout_thread_t * __vout_Create( vlc_object_t *p_parent, video_format_t *p_fmt )
 
     /* Initialize subpicture unit */
     p_vout->p_spu = spu_Create( p_vout );
-    spu_Attach( p_vout->p_spu, p_parent, true );
 
     /* Attach the new object now so we can use var inheritance below */
     vlc_object_attach( p_vout, p_parent );
 
+    /* */
     spu_Init( p_vout->p_spu );
 
+    spu_Attach( p_vout->p_spu, VLC_OBJECT(p_vout), true );
+
     /* Take care of some "interface/control" related initialisations */
     vout_IntfInit( p_vout );
 
diff --git a/src/video_output/vout_subpictures.c b/src/video_output/vout_subpictures.c
index 1dc316f..393b4bb 100644
--- a/src/video_output/vout_subpictures.c
+++ b/src/video_output/vout_subpictures.c
@@ -300,7 +300,8 @@ void spu_Attach( spu_t *p_spu, vlc_object_t *p_this, bool b_attach )
     vlc_object_t *p_input;
 
     p_input = vlc_object_find( p_this, VLC_OBJECT_INPUT, FIND_PARENT );
-    if( !p_input ) return;
+    if( !p_input )
+        return;
 
     if( b_attach )
     {




More information about the vlc-devel mailing list