]> git.sesse.net Git - vlc/blobdiff - src/video_output/video_output.c
playlist: Use vlc_object_alive().
[vlc] / src / video_output / video_output.c
index 78faddac9d8f55bbe9d6e87e5cba76631dc37710..74bcacdebfac32bec0cbfa36a0ce3531e730eaff 100644 (file)
@@ -508,19 +508,21 @@ static void vout_Destructor( vlc_object_t * p_this )
 
 #ifndef __APPLE__
     vout_thread_t *p_another_vout;
-    playlist_t *p_playlist = pl_Yield( p_vout );
-
-    /* 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,
-       where we have this novelty called menubar, that will always allow you access
-       to the applications main functionality. They should try that on linux sometime */
-    p_another_vout = vlc_object_find( p_this->p_libvlc,
-                                      VLC_OBJECT_VOUT, FIND_ANYWHERE );
-    if( p_another_vout == NULL )
-    {
-        vlc_value_t val;
-        val.b_bool = VLC_TRUE;
-        var_Set( p_playlist, "intf-show", val );
+
+    playlist_t *p_playlist = pl_Get( p_vout );
+    if( p_playlist->b_die ) return;
+    vlc_object_yield( p_playlist );
+/* 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,
+   where we have this novelty called menubar, that will always allow you access
+   to the applications main functionality. They should try that on linux sometime */
+        p_another_vout = vlc_object_find( p_this->p_libvlc,
+                                          VLC_OBJECT_VOUT, FIND_ANYWHERE );
+        if( p_another_vout == NULL )
+        {
+            vlc_value_t val;
+            val.b_bool = VLC_TRUE;
+            var_Set( p_playlist, "intf-show", val );
     }
     else
     {
@@ -778,12 +780,6 @@ static void RunThread( vout_thread_t *p_vout)
         display_date = 0;
         current_date = mdate();
 
-        if( p_input && p_input->b_die )
-        {
-            vlc_object_release( p_input );
-            p_input = NULL;
-        }
-
         i_loops++;
             if( !p_input )
             {
@@ -800,6 +796,8 @@ static void RunThread( vout_thread_t *p_vout)
                                      i_displayed , NULL);
                 i_displayed = i_lost = 0;
                 vlc_mutex_unlock( &p_input->p->counters.counters_lock );
+                vlc_object_release( p_input );
+                p_input = NULL;
             }
 #if 0
         p_vout->c_loops++;
@@ -1056,6 +1054,9 @@ static void RunThread( vout_thread_t *p_vout)
             }
             p_subpic = spu_SortSubpictures( p_vout->p_spu, display_date,
             p_input ? var_GetBool( p_input, "state" ) == PAUSE_S : VLC_FALSE );
+            if( p_input )
+                vlc_object_release( p_input );
+            p_input = NULL;
         }
 
         /*