Changeset 476255ccf367929c2bf66ea7805ee8fcbabe1945
- 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
| r55f3a9f |
r476255c |
|
| 39 | 39 | static void RunPreparse( playlist_preparse_t * ); |
|---|
| 40 | 40 | static void RunFetcher( playlist_fetcher_t * ); |
|---|
| | 41 | static void PreparseDestructor( vlc_object_t * ); |
|---|
| | 42 | static void FetcherDestructor( vlc_object_t * ); |
|---|
| 41 | 43 | |
|---|
| 42 | 44 | /***************************************************************************** |
|---|
| … | … | |
| 79 | 81 | p_playlist->p_preparse->pp_waiting = NULL; |
|---|
| 80 | 82 | |
|---|
| | 83 | vlc_object_set_destructor( p_playlist->p_preparse, PreparseDestructor ); |
|---|
| | 84 | |
|---|
| 81 | 85 | vlc_object_attach( p_playlist->p_preparse, p_playlist ); |
|---|
| 82 | 86 | if( vlc_thread_create( p_playlist->p_preparse, "preparser", |
|---|
| … | … | |
| 84 | 88 | { |
|---|
| 85 | 89 | msg_Err( p_playlist, "cannot spawn preparse thread" ); |
|---|
| 86 | | vlc_object_detach( p_playlist->p_preparse ); |
|---|
| 87 | 90 | vlc_object_release( p_playlist->p_preparse ); |
|---|
| 88 | 91 | return; |
|---|
| … | … | |
| 105 | 108 | "album-art" ); |
|---|
| 106 | 109 | |
|---|
| | 110 | vlc_object_set_destructor( p_playlist->p_fetcher, FetcherDestructor ); |
|---|
| | 111 | |
|---|
| 107 | 112 | vlc_object_attach( p_playlist->p_fetcher, p_playlist ); |
|---|
| 108 | 113 | if( vlc_thread_create( p_playlist->p_fetcher, |
|---|
| … | … | |
| 112 | 117 | { |
|---|
| 113 | 118 | msg_Err( p_playlist, "cannot spawn secondary preparse thread" ); |
|---|
| 114 | | vlc_object_detach( p_playlist->p_fetcher ); |
|---|
| 115 | 119 | vlc_object_release( p_playlist->p_fetcher ); |
|---|
| 116 | 120 | return; |
|---|
| … | … | |
| 147 | 151 | if( p_playlist->p_preparse ) |
|---|
| 148 | 152 | { |
|---|
| 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 ); |
|---|
| 153 | 153 | vlc_object_release( p_playlist->p_preparse ); |
|---|
| 154 | 154 | } |
|---|
| … | … | |
| 157 | 157 | if( p_playlist->p_fetcher ) |
|---|
| 158 | 158 | { |
|---|
| 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 ); |
|---|
| 163 | 159 | vlc_object_release( p_playlist->p_fetcher ); |
|---|
| 164 | 160 | } |
|---|
| … | … | |
| 222 | 218 | playlist_FetcherLoop( p_obj ); |
|---|
| 223 | 219 | } |
|---|
| | 220 | |
|---|
| | 221 | static 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 | |
|---|
| | 227 | static 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 | } |
|---|