[vlc-commits] stream_Demux: remove unsafe pointer access

Rémi Denis-Courmont git at videolan.org
Tue Aug 21 16:38:40 CEST 2012


vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Tue Aug 21 17:30:56 2012 +0300| [619cdda986bfb14332a07cbc33a078bbdd09fa09] | committer: Rémi Denis-Courmont

stream_Demux: remove unsafe pointer access

In the original stream_Demux (from 2004), there was a lock. But then
it vanished in a big input "rework"... Anyway, killing the demux
explicitly should not be needed: The underlying stream will return EOF
and any sane demux will return on EOF.

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

 src/input/stream_demux.c |    6 +-----
 1 file changed, 1 insertion(+), 5 deletions(-)

diff --git a/src/input/stream_demux.c b/src/input/stream_demux.c
index adb134b..d7bb55d 100644
--- a/src/input/stream_demux.c
+++ b/src/input/stream_demux.c
@@ -118,9 +118,6 @@ static void DStreamDelete( stream_t *s )
     block_t *p_empty;
 
     vlc_object_kill( s );
-#warning FIXME: not thread-safe:
-    if( p_sys->p_demux )
-        vlc_object_kill( p_sys->p_demux );
     p_empty = block_New( s, 1 ); p_empty->i_buffer = 0;
     block_FifoPut( p_sys->p_fifo, p_empty );
     vlc_join( p_sys->thread, NULL );
@@ -293,12 +290,11 @@ static void* DStreamThread( void *obj )
     p_sys->p_demux = p_demux;
 
     /* Main loop */
-    while( vlc_object_alive( s ) && vlc_object_alive( p_demux ) )
+    while( vlc_object_alive( s ) )
     {
         if( demux_Demux( p_demux ) <= 0 ) break;
     }
 
     vlc_restorecancel( canc );
-    vlc_object_kill( p_demux );
     return NULL;
 }



More information about the vlc-commits mailing list