[vlc-devel] commit: playlist: Fix input item deletion (stupid macros), and don' t send to the fetcher if it is dead. (Pierre d'Herbemont )

git version control git at videolan.org
Sun Jul 13 23:56:42 CEST 2008


vlc | branch: master | Pierre d'Herbemont <pdherbemont at videolan.org> | Sun Jul 13 23:56:53 2008 +0200| [1fac4d77a9b862ec150ade10173015a96986c608]

playlist: Fix input item deletion (stupid macros), and don't send to the fetcher if it is dead.

Fix #1704

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

 src/playlist/engine.c |   21 +++++++++++++--------
 1 files changed, 13 insertions(+), 8 deletions(-)

diff --git a/src/playlist/engine.c b/src/playlist/engine.c
index 2aa85d1..43340c9 100644
--- a/src/playlist/engine.c
+++ b/src/playlist/engine.c
@@ -582,10 +582,15 @@ void playlist_PreparseLoop( playlist_preparse_t *p_obj )
             {
                 PL_DEBUG("meta ok for %s, need to fetch art", psz_name );
                 vlc_object_lock( p_playlist->p_fetcher );
-                INSERT_ELEM( p_playlist->p_fetcher->pp_waiting,
-                             p_playlist->p_fetcher->i_waiting,
-                             p_playlist->p_fetcher->i_waiting, p_current);
-                vlc_object_signal_unlocked( p_playlist->p_fetcher );
+                if( vlc_object_alive( p_playlist->p_fetcher ) )
+                {
+                    INSERT_ELEM( p_playlist->p_fetcher->pp_waiting,
+                        p_playlist->p_fetcher->i_waiting,
+                        p_playlist->p_fetcher->i_waiting, p_current);
+                    vlc_object_signal_unlocked( p_playlist->p_fetcher );
+                }
+                else
+                    vlc_gc_decref( p_current );
                 vlc_object_unlock( p_playlist->p_fetcher );
             }
             else
@@ -610,9 +615,9 @@ void playlist_PreparseLoop( playlist_preparse_t *p_obj )
         vlc_object_lock( p_obj );
     }
 
-    for( int i = 0; i < p_obj->i_waiting; i++ )
+    while( p_obj->i_waiting > 0 )
     {
-        vlc_gc_decref( p_obj->pp_waiting[i] );
+        vlc_gc_decref( p_obj->pp_waiting[0] );
         REMOVE_ELEM( p_obj->pp_waiting, p_obj->i_waiting, 0 );
     }
 
@@ -698,9 +703,9 @@ void playlist_FetcherLoop( playlist_fetcher_t *p_obj )
         vlc_object_lock( p_obj );
     }
 
-    for( int i = 0; i < p_obj->i_waiting; i++ )
+    while( p_obj->i_waiting > 0 )
     {
-        vlc_gc_decref( p_obj->pp_waiting[i] );
+        vlc_gc_decref( p_obj->pp_waiting[0] );
         REMOVE_ELEM( p_obj->pp_waiting, p_obj->i_waiting, 0 );
     }
 




More information about the vlc-devel mailing list