]> git.sesse.net Git - vlc/commitdiff
Improved vout_Request when using a vout attached to playlist.
authorLaurent Aimar <fenrir@videolan.org>
Mon, 26 Feb 2007 19:21:03 +0000 (19:21 +0000)
committerLaurent Aimar <fenrir@videolan.org>
Mon, 26 Feb 2007 19:21:03 +0000 (19:21 +0000)
(Avoid a possible race condition)

src/video_output/video_output.c

index 45b6edfde0cfa8c3d98b11c42b489259e7644107..38ab8214d00d3ba1352f8c2039bb7be05e92db2c 100644 (file)
@@ -148,6 +148,8 @@ vout_thread_t *__vout_Request( vlc_object_t *p_this, vout_thread_t *p_vout,
                 vlc_object_release( p_vout );
                 p_vout = NULL;
             }
+            if( p_vout )
+                vlc_object_detach( p_vout );    /* Remove it from the GC */
             vlc_mutex_unlock( &p_playlist->gc_lock );
             pl_Release( p_this );
         }
@@ -192,7 +194,6 @@ vout_thread_t *__vout_Request( vlc_object_t *p_this, vout_thread_t *p_vout,
             p_vout->b_filter_change )
         {
             /* We are not interested in this format, close this vout */
-            vlc_object_detach( p_vout );
             vlc_object_release( p_vout );
             vout_Destroy( p_vout );
             p_vout = NULL;
@@ -200,7 +201,6 @@ vout_thread_t *__vout_Request( vlc_object_t *p_this, vout_thread_t *p_vout,
         else
         {
             /* This video output is cool! Hijack it. */
-            vlc_object_detach( p_vout );
             spu_Attach( p_vout->p_spu, p_this, VLC_TRUE );
             vlc_object_attach( p_vout, p_this );
             vlc_object_release( p_vout );