Changeset 476255ccf367929c2bf66ea7805ee8fcbabe1945

Show
Ignore:
Timestamp:
26/03/08 17:36:05 (8 months ago)
Author:
Pierre d'Herbemont <pdherbemont@videolan.org>
git-committer:
Pierre d'Herbemont <pdherbemont@videolan.org> 1206549365 +0100
git-parent:

[8bf64ccc76a40c0ba7c2089ed5e08f58a5f405f3]

git-author:
Pierre d'Herbemont <pdherbemont@videolan.org> 1206488809 +0100
Message:

playlist: Properly destroy the preparser and the fetcher objects.

vlc_thread_join() and vlc_object_detach() are correctly run from vlc_object_release() now.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • src/playlist/thread.c

    r55f3a9f r476255c  
    3939static void RunPreparse( playlist_preparse_t * ); 
    4040static void RunFetcher( playlist_fetcher_t * ); 
     41static void PreparseDestructor( vlc_object_t * ); 
     42static void FetcherDestructor( vlc_object_t * ); 
    4143 
    4244/***************************************************************************** 
     
    7981    p_playlist->p_preparse->pp_waiting = NULL; 
    8082 
     83    vlc_object_set_destructor( p_playlist->p_preparse, PreparseDestructor ); 
     84 
    8185    vlc_object_attach( p_playlist->p_preparse, p_playlist ); 
    8286    if( vlc_thread_create( p_playlist->p_preparse, "preparser", 
     
    8488    { 
    8589        msg_Err( p_playlist, "cannot spawn preparse thread" ); 
    86         vlc_object_detach( p_playlist->p_preparse ); 
    8790        vlc_object_release( p_playlist->p_preparse ); 
    8891        return; 
     
    105108                                                                "album-art" ); 
    106109 
     110    vlc_object_set_destructor( p_playlist->p_fetcher, FetcherDestructor ); 
     111 
    107112    vlc_object_attach( p_playlist->p_fetcher, p_playlist ); 
    108113    if( vlc_thread_create( p_playlist->p_fetcher, 
     
    112117    { 
    113118        msg_Err( p_playlist, "cannot spawn secondary preparse thread" ); 
    114         vlc_object_detach( p_playlist->p_fetcher ); 
    115119        vlc_object_release( p_playlist->p_fetcher ); 
    116120        return; 
     
    147151    if( p_playlist->p_preparse ) 
    148152    { 
    149         vlc_object_kill( p_playlist->p_preparse ); 
    150         vlc_thread_join( p_playlist->p_preparse ); 
    151         free( p_playlist->p_preparse->pp_waiting ); 
    152         vlc_object_detach( p_playlist->p_preparse ); 
    153153        vlc_object_release( p_playlist->p_preparse ); 
    154154    } 
     
    157157    if( p_playlist->p_fetcher ) 
    158158    { 
    159         vlc_object_kill( p_playlist->p_fetcher ); 
    160         vlc_thread_join( p_playlist->p_fetcher ); 
    161         free( p_playlist->p_fetcher->p_waiting ); 
    162         vlc_object_detach( p_playlist->p_fetcher ); 
    163159        vlc_object_release( p_playlist->p_fetcher ); 
    164160    } 
     
    222218    playlist_FetcherLoop( p_obj ); 
    223219} 
     220 
     221static void PreparseDestructor( vlc_object_t * p_this ) 
     222{ 
     223    playlist_preparse_t * p_preparse = (playlist_preparse_t *)p_this; 
     224    free( p_preparse->pp_waiting ); 
     225} 
     226 
     227static void FetcherDestructor( vlc_object_t * p_this ) 
     228{ 
     229    playlist_fetcher_t * p_fetcher = (playlist_fetcher_t *)p_this; 
     230    free( p_fetcher->p_waiting ); 
     231}