[vlc-commits] Do not access b_die directly

Rémi Denis-Courmont git at videolan.org
Sat Nov 10 18:24:11 CET 2012


vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Sat Nov 10 19:22:47 2012 +0200| [7141d755ff50c1dc4fca03b02d0c57657d0ff184] | committer: Rémi Denis-Courmont

Do not access b_die directly

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

 lib/media_player.c                    |    2 +-
 modules/access/linsys/linsys_hdsdi.c  |    4 ++--
 modules/access/mms/mms.c              |    2 +-
 modules/access/mms/mmstu.c            |    2 +-
 modules/stream_filter/smooth/smooth.c |    2 +-
 src/input/es_out.c                    |    2 +-
 src/input/stream.c                    |    8 ++++----
 src/network/io.c                      |    2 --
 src/playlist/item.c                   |    7 +++++--
 src/playlist/thread.c                 |    4 ++--
 10 files changed, 18 insertions(+), 17 deletions(-)

diff --git a/lib/media_player.c b/lib/media_player.c
index 2eb524d..0ac4896 100644
--- a/lib/media_player.c
+++ b/lib/media_player.c
@@ -1230,7 +1230,7 @@ int libvlc_media_player_will_play( libvlc_media_player_t *p_mi )
     if ( !p_input_thread )
         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 );
 
     return b_will_play;
diff --git a/modules/access/linsys/linsys_hdsdi.c b/modules/access/linsys/linsys_hdsdi.c
index 457886b..bc480ee 100644
--- a/modules/access/linsys/linsys_hdsdi.c
+++ b/modules/access/linsys/linsys_hdsdi.c
@@ -669,7 +669,7 @@ static int InitCapture( demux_t *p_demux )
     }
 
     /* Wait for standard to settle down */
-    while ( !p_demux->b_die )
+    while ( vlc_object_alive(p_demux) )
     {
         struct pollfd pfd[1];
 
@@ -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 );
         return VLC_EGENERIC;
diff --git a/modules/access/mms/mms.c b/modules/access/mms/mms.c
index f01c1ed..50662b8 100644
--- a/modules/access/mms/mms.c
+++ b/modules/access/mms/mms.c
@@ -119,7 +119,7 @@ static int Open( vlc_object_t *p_this )
 
     if( MMSTUOpen ( p_access ) )
     {
-        if( p_access->b_die )
+        if( !vlc_object_alive(p_access) )
             return VLC_EGENERIC;
 
         /* try mmsh if mmstu failed */
diff --git a/modules/access/mms/mmstu.c b/modules/access/mms/mmstu.c
index 972532b..7ffc206 100644
--- a/modules/access/mms/mmstu.c
+++ b/modules/access/mms/mmstu.c
@@ -140,7 +140,7 @@ int  MMSTUOpen( access_t *p_access )
     {   /* first try with TCP and then UDP*/
         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 );
         }
     }
diff --git a/modules/stream_filter/smooth/smooth.c b/modules/stream_filter/smooth/smooth.c
index 15bc5f7..f0c3d8a 100644
--- a/modules/stream_filter/smooth/smooth.c
+++ b/modules/stream_filter/smooth/smooth.c
@@ -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
          * understood well, there is no good solution with a stream_filter
          * 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 );
             msg_Warn( s, "get_chunk failed! (playback index %u)",
diff --git a/src/input/es_out.c b/src/input/es_out.c
index 1a0053d..c566287 100644
--- a/src/input/es_out.c
+++ b/src/input/es_out.c
@@ -2015,7 +2015,7 @@ static void EsOutDel( es_out_t *out, es_out_id_t *es )
     /* We don't try to reselect */
     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 ) &&
                 ( !es->p_dec_record || input_DecoderIsEmpty( es->p_dec_record ) ))
diff --git a/src/input/stream.c b/src/input/stream.c
index fa01b3e..bf72c7a 100644
--- a/src/input/stream.c
+++ b/src/input/stream.c
@@ -662,7 +662,7 @@ static void AStreamPrebufferBlock( stream_t *s )
         bool b_eof;
         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;
 
@@ -1000,7 +1000,7 @@ static int AStreamRefillBlock( stream_t *s )
     {
         bool b_eof;
 
-        if( s->b_die )
+        if( !vlc_object_alive(s) )
             return VLC_EGENERIC;
 
         /* Fetch a block */
@@ -1356,7 +1356,7 @@ static int AStreamRefillStream( stream_t *s )
         int i_off = tk->i_end % STREAM_CACHE_TRACK_SIZE;
         int i_read;
 
-        if( s->b_die )
+        if( !vlc_object_alive(s) )
             return VLC_EGENERIC;
 
         i_read = __MIN( i_toread, STREAM_CACHE_TRACK_SIZE - i_off );
@@ -1417,7 +1417,7 @@ static void AStreamPrebufferStream( stream_t *s )
         int i_read;
         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;
 
diff --git a/src/network/io.c b/src/network/io.c
index f651a8e..7cc9764 100644
--- a/src/network/io.c
+++ b/src/network/io.c
@@ -288,7 +288,6 @@ net_Read (vlc_object_t *restrict p_this, int fd, const v_socket_t *vs,
         {
             if (ufd[1].revents)
             {
-                assert (p_this->b_die);
                 msg_Dbg (p_this, "socket %d polling interrupted", fd);
 #if defined(WIN32)
                 WSASetLastError (WSAEINTR);
@@ -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)
             {
-                assert (p_this->b_die);
                 errno = EINTR;
                 goto error;
             }
diff --git a/src/playlist/item.c b/src/playlist/item.c
index 2b99dce..f5fde96 100644
--- a/src/playlist/item.c
+++ b/src/playlist/item.c
@@ -451,7 +451,8 @@ int playlist_AddInput( playlist_t* p_playlist, input_item_t *p_input,
                        bool b_locked )
 {
     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 )
         PL_DEBUG( "adding item `%s' ( %s )", p_input->psz_name,
                                              p_input->psz_uri );
@@ -493,8 +494,10 @@ playlist_item_t * playlist_NodeAddInput( playlist_t *p_playlist,
     assert( p_input );
     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;
+
     PL_LOCK_IF( !b_locked );
 
     p_item = playlist_ItemNewFromInput( p_playlist, p_input );
diff --git a/src/playlist/thread.c b/src/playlist/thread.c
index 68d11a2..07a6b71 100644
--- a/src/playlist/thread.c
+++ b/src/playlist/thread.c
@@ -459,7 +459,7 @@ static int LoopInput( playlist_t *p_playlist )
     if( !p_input )
         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" );
         input_Stop( p_input, true );
@@ -490,7 +490,7 @@ static int LoopInput( playlist_t *p_playlist )
         return VLC_EGENERIC;
     }
     /* This input is dying, let it do */
-    else if( p_input->b_die )
+    else if( !vlc_object_alive(p_input) )
     {
         PL_DEBUG( "dying input" );
     }



More information about the vlc-commits mailing list