Commit 7141d755 authored by Rémi Denis-Courmont's avatar Rémi Denis-Courmont

Do not access b_die directly

parent a9d42c83
...@@ -1230,7 +1230,7 @@ int libvlc_media_player_will_play( libvlc_media_player_t *p_mi ) ...@@ -1230,7 +1230,7 @@ int libvlc_media_player_will_play( libvlc_media_player_t *p_mi )
if ( !p_input_thread ) if ( !p_input_thread )
return false; return false;
b_will_play = !p_input_thread->b_die && !p_input_thread->b_dead; b_will_play = !p_input_thread->b_dead;
vlc_object_release( p_input_thread ); vlc_object_release( p_input_thread );
return b_will_play; return b_will_play;
......
...@@ -669,7 +669,7 @@ static int InitCapture( demux_t *p_demux ) ...@@ -669,7 +669,7 @@ static int InitCapture( demux_t *p_demux )
} }
/* Wait for standard to settle down */ /* Wait for standard to settle down */
while ( !p_demux->b_die ) while ( vlc_object_alive(p_demux) )
{ {
struct pollfd pfd[1]; struct pollfd pfd[1];
...@@ -707,7 +707,7 @@ static int InitCapture( demux_t *p_demux ) ...@@ -707,7 +707,7 @@ static int InitCapture( demux_t *p_demux )
} }
} }
} }
if ( p_demux->b_die ) if ( !vlc_object_alive(p_demux) )
{ {
close( p_sys->i_vfd ); close( p_sys->i_vfd );
return VLC_EGENERIC; return VLC_EGENERIC;
......
...@@ -119,7 +119,7 @@ static int Open( vlc_object_t *p_this ) ...@@ -119,7 +119,7 @@ static int Open( vlc_object_t *p_this )
if( MMSTUOpen ( p_access ) ) if( MMSTUOpen ( p_access ) )
{ {
if( p_access->b_die ) if( !vlc_object_alive(p_access) )
return VLC_EGENERIC; return VLC_EGENERIC;
/* try mmsh if mmstu failed */ /* try mmsh if mmstu failed */
......
...@@ -140,7 +140,7 @@ int MMSTUOpen( access_t *p_access ) ...@@ -140,7 +140,7 @@ int MMSTUOpen( access_t *p_access )
{ /* first try with TCP and then UDP*/ { /* first try with TCP and then UDP*/
if( ( i_status = MMSOpen( p_access, &p_sys->url, MMS_PROTO_TCP ) ) ) if( ( i_status = MMSOpen( p_access, &p_sys->url, MMS_PROTO_TCP ) ) )
{ {
if( !p_access->b_die ) if( vlc_object_alive(p_access) )
i_status = MMSOpen( p_access, &p_sys->url, MMS_PROTO_UDP ); i_status = MMSOpen( p_access, &p_sys->url, MMS_PROTO_UDP );
} }
} }
......
...@@ -528,7 +528,7 @@ static chunk_t *get_chunk( stream_t *s, const bool wait ) ...@@ -528,7 +528,7 @@ static chunk_t *get_chunk( stream_t *s, const bool wait )
* that's why vlc_object_alive() has been deprecated. But if I * that's why vlc_object_alive() has been deprecated. But if I
* understood well, there is no good solution with a stream_filter * understood well, there is no good solution with a stream_filter
* module anyaway. */ * module anyaway. */
if( !wait || s->b_die || p_sys->b_error ) if( !wait || p_sys->b_error )
{ {
vlc_mutex_unlock( &p_sys->download.lock_wait ); vlc_mutex_unlock( &p_sys->download.lock_wait );
msg_Warn( s, "get_chunk failed! (playback index %u)", msg_Warn( s, "get_chunk failed! (playback index %u)",
......
...@@ -2015,7 +2015,7 @@ static void EsOutDel( es_out_t *out, es_out_id_t *es ) ...@@ -2015,7 +2015,7 @@ static void EsOutDel( es_out_t *out, es_out_id_t *es )
/* We don't try to reselect */ /* We don't try to reselect */
if( es->p_dec ) if( es->p_dec )
{ {
while( !p_sys->p_input->b_die && !p_sys->b_buffering && es->p_dec ) while( vlc_object_alive(p_sys->p_input) && !p_sys->b_buffering && es->p_dec )
{ {
if( input_DecoderIsEmpty( es->p_dec ) && if( input_DecoderIsEmpty( es->p_dec ) &&
( !es->p_dec_record || input_DecoderIsEmpty( es->p_dec_record ) )) ( !es->p_dec_record || input_DecoderIsEmpty( es->p_dec_record ) ))
......
...@@ -662,7 +662,7 @@ static void AStreamPrebufferBlock( stream_t *s ) ...@@ -662,7 +662,7 @@ static void AStreamPrebufferBlock( stream_t *s )
bool b_eof; bool b_eof;
block_t *b; block_t *b;
if( s->b_die || p_sys->block.i_size > STREAM_CACHE_PREBUFFER_SIZE ) if( !vlc_object_alive(s) || p_sys->block.i_size > STREAM_CACHE_PREBUFFER_SIZE )
{ {
int64_t i_byterate; int64_t i_byterate;
...@@ -1000,7 +1000,7 @@ static int AStreamRefillBlock( stream_t *s ) ...@@ -1000,7 +1000,7 @@ static int AStreamRefillBlock( stream_t *s )
{ {
bool b_eof; bool b_eof;
if( s->b_die ) if( !vlc_object_alive(s) )
return VLC_EGENERIC; return VLC_EGENERIC;
/* Fetch a block */ /* Fetch a block */
...@@ -1356,7 +1356,7 @@ static int AStreamRefillStream( stream_t *s ) ...@@ -1356,7 +1356,7 @@ static int AStreamRefillStream( stream_t *s )
int i_off = tk->i_end % STREAM_CACHE_TRACK_SIZE; int i_off = tk->i_end % STREAM_CACHE_TRACK_SIZE;
int i_read; int i_read;
if( s->b_die ) if( !vlc_object_alive(s) )
return VLC_EGENERIC; return VLC_EGENERIC;
i_read = __MIN( i_toread, STREAM_CACHE_TRACK_SIZE - i_off ); i_read = __MIN( i_toread, STREAM_CACHE_TRACK_SIZE - i_off );
...@@ -1417,7 +1417,7 @@ static void AStreamPrebufferStream( stream_t *s ) ...@@ -1417,7 +1417,7 @@ static void AStreamPrebufferStream( stream_t *s )
int i_read; int i_read;
int i_buffered = tk->i_end - tk->i_start; int i_buffered = tk->i_end - tk->i_start;
if( s->b_die || i_buffered >= STREAM_CACHE_PREBUFFER_SIZE ) if( !vlc_object_alive(s) || i_buffered >= STREAM_CACHE_PREBUFFER_SIZE )
{ {
int64_t i_byterate; int64_t i_byterate;
......
...@@ -288,7 +288,6 @@ net_Read (vlc_object_t *restrict p_this, int fd, const v_socket_t *vs, ...@@ -288,7 +288,6 @@ net_Read (vlc_object_t *restrict p_this, int fd, const v_socket_t *vs,
{ {
if (ufd[1].revents) if (ufd[1].revents)
{ {
assert (p_this->b_die);
msg_Dbg (p_this, "socket %d polling interrupted", fd); msg_Dbg (p_this, "socket %d polling interrupted", fd);
#if defined(WIN32) #if defined(WIN32)
WSASetLastError (WSAEINTR); WSASetLastError (WSAEINTR);
...@@ -442,7 +441,6 @@ ssize_t net_Write( vlc_object_t *p_this, int fd, const v_socket_t *p_vs, ...@@ -442,7 +441,6 @@ ssize_t net_Write( vlc_object_t *p_this, int fd, const v_socket_t *p_vs,
{ {
if (ufd[1].revents) if (ufd[1].revents)
{ {
assert (p_this->b_die);
errno = EINTR; errno = EINTR;
goto error; goto error;
} }
......
...@@ -451,7 +451,8 @@ int playlist_AddInput( playlist_t* p_playlist, input_item_t *p_input, ...@@ -451,7 +451,8 @@ int playlist_AddInput( playlist_t* p_playlist, input_item_t *p_input,
bool b_locked ) bool b_locked )
{ {
playlist_item_t *p_item; playlist_item_t *p_item;
if( p_playlist->b_die ) return VLC_EGENERIC; /* FIXME: use b_killed instead: */
if( !vlc_object_alive(p_playlist) ) return VLC_EGENERIC;
if( !pl_priv(p_playlist)->b_doing_ml ) if( !pl_priv(p_playlist)->b_doing_ml )
PL_DEBUG( "adding item `%s' ( %s )", p_input->psz_name, PL_DEBUG( "adding item `%s' ( %s )", p_input->psz_name,
p_input->psz_uri ); p_input->psz_uri );
...@@ -493,8 +494,10 @@ playlist_item_t * playlist_NodeAddInput( playlist_t *p_playlist, ...@@ -493,8 +494,10 @@ playlist_item_t * playlist_NodeAddInput( playlist_t *p_playlist,
assert( p_input ); assert( p_input );
assert( p_parent && p_parent->i_children != -1 ); assert( p_parent && p_parent->i_children != -1 );
if( p_playlist->b_die ) /* FIXME: use b_killed instead: */
if( !vlc_object_alive(p_playlist) )
return NULL; return NULL;
PL_LOCK_IF( !b_locked ); PL_LOCK_IF( !b_locked );
p_item = playlist_ItemNewFromInput( p_playlist, p_input ); p_item = playlist_ItemNewFromInput( p_playlist, p_input );
......
...@@ -459,7 +459,7 @@ static int LoopInput( playlist_t *p_playlist ) ...@@ -459,7 +459,7 @@ static int LoopInput( playlist_t *p_playlist )
if( !p_input ) if( !p_input )
return VLC_EGENERIC; return VLC_EGENERIC;
if( ( p_sys->request.b_request || p_sys->killed ) && !p_input->b_die ) if( ( p_sys->request.b_request || p_sys->killed ) && vlc_object_alive(p_input) )
{ {
PL_DEBUG( "incoming request - stopping current input" ); PL_DEBUG( "incoming request - stopping current input" );
input_Stop( p_input, true ); input_Stop( p_input, true );
...@@ -490,7 +490,7 @@ static int LoopInput( playlist_t *p_playlist ) ...@@ -490,7 +490,7 @@ static int LoopInput( playlist_t *p_playlist )
return VLC_EGENERIC; return VLC_EGENERIC;
} }
/* This input is dying, let it do */ /* This input is dying, let it do */
else if( p_input->b_die ) else if( !vlc_object_alive(p_input) )
{ {
PL_DEBUG( "dying input" ); PL_DEBUG( "dying input" );
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment