Changeset 89e10b6c29b7b18ad251b2f55da95a961d54a554
- Timestamp:
- 07/05/08 16:29:04
(2 months ago)
- Author:
- Rémi Denis-Courmont <rdenis@simphalempin.com>
- git-committer:
- Rémi Denis-Courmont <rdenis@simphalempin.com> 1215268144 +0300
- git-parent:
[69022122e6df8208d33a5809674e1f6b9bd4bcbb]
- git-author:
- Rémi Denis-Courmont <rdenis@simphalempin.com> 1215268144 +0300
- Message:
pl_Yield(): return NULL when the playlist is gone (or going)
This allows using pl_Yield() from video outputs and friends, on
condition that pl_Yield() return value be checked for NULLity.
Should fix #1667.
-
Files:
-
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
| r6902212 |
r89e10b6 |
|
| 955 | 955 | #endif |
|---|
| 956 | 956 | |
|---|
| | 957 | playlist_t *p_playlist = priv->p_playlist; |
|---|
| 957 | 958 | /* Remove all services discovery */ |
|---|
| 958 | 959 | msg_Dbg( p_libvlc, "removing all services discovery tasks" ); |
|---|
| 959 | | playlist_ServicesDiscoveryKillAll( priv->p_playlist ); |
|---|
| | 960 | playlist_ServicesDiscoveryKillAll( p_playlist ); |
|---|
| 960 | 961 | |
|---|
| 961 | 962 | /* Free playlist */ |
|---|
| | 963 | /* Any thread still running must not assume pl_Yield() succeeds. */ |
|---|
| 962 | 964 | msg_Dbg( p_libvlc, "removing playlist" ); |
|---|
| 963 | | vlc_object_kill( priv->p_playlist ); |
|---|
| 964 | | vlc_thread_join( priv->p_playlist ); |
|---|
| 965 | | vlc_object_release( priv->p_playlist ); |
|---|
| | 965 | priv->p_playlist = NULL; |
|---|
| | 966 | vlc_object_kill( p_playlist ); /* <-- memory barrier for pl_Yield() */ |
|---|
| | 967 | vlc_thread_join( p_playlist ); |
|---|
| | 968 | vlc_object_release( p_playlist ); |
|---|
| 966 | 969 | |
|---|
| 967 | 970 | /* Free interaction */ |
|---|
| r23d1d36 |
r89e10b6 |
|
| 44 | 44 | playlist_t *__pl_Yield( vlc_object_t *p_this ) |
|---|
| 45 | 45 | { |
|---|
| 46 | | playlist_t *pl = libvlc_priv (p_this->p_libvlc)->p_playlist; |
|---|
| 47 | | /* Objects that are destroyed _after_ the playlist cannot use pl_Yield() */ |
|---|
| 48 | | assert (p_this->i_object_type != VLC_OBJECT_VOUT); |
|---|
| 49 | | assert (p_this->i_object_type != VLC_OBJECT_ANNOUNCE); |
|---|
| 50 | | assert ((void *)p_this != libvlc_priv (p_this->p_libvlc)->p_interaction); |
|---|
| 51 | | |
|---|
| 52 | | assert( pl != NULL ); |
|---|
| 53 | | vlc_object_yield( pl ); |
|---|
| | 46 | playlist_t *pl; |
|---|
| | 47 | |
|---|
| | 48 | barrier (); |
|---|
| | 49 | pl = libvlc_priv (p_this->p_libvlc)->p_playlist; |
|---|
| | 50 | if (pl) |
|---|
| | 51 | vlc_object_yield (pl); |
|---|
| 54 | 52 | return pl; |
|---|
| 55 | 53 | } |
|---|
| rd90d8b7 |
r89e10b6 |
|
| 174 | 174 | if( p_playlist->p_fetcher ) |
|---|
| 175 | 175 | vlc_object_release( p_playlist->p_fetcher ); |
|---|
| 176 | | #ifndef NDEBUG |
|---|
| 177 | | libvlc_priv (p_this->p_libvlc)->p_playlist = NULL; /* pl_Yield() will fail */ |
|---|
| 178 | | #endif |
|---|
| 179 | 176 | } |
|---|
| 180 | 177 | |
|---|