[vlc-commits] visual: remove non-sensical code

Rémi Denis-Courmont git at videolan.org
Fri Apr 19 21:30:10 CEST 2013


vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Fri Apr 19 22:29:35 2013 +0300| [b9cc6e26f6348ae552ca7a5323d4735c3a84be98] | committer: Rémi Denis-Courmont

visual: remove non-sensical code

This mostly reverts commit fc5156cc00225de64eb9b8715809c6a84e48b35e.
This also fixes a use-after-free bug.

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

 modules/visualization/visual/visual.c |   18 +-----------------
 modules/visualization/visual/visual.h |    2 --
 2 files changed, 1 insertion(+), 19 deletions(-)

diff --git a/modules/visualization/visual/visual.c b/modules/visualization/visual/visual.c
index 67619ff..5698278 100644
--- a/modules/visualization/visual/visual.c
+++ b/modules/visualization/visual/visual.c
@@ -192,8 +192,6 @@ static int Open( vlc_object_t *p_this )
     if( (p_sys->i_height % 2 ) != 0 ) p_sys->i_height--;
     if( (p_sys->i_width % 2 )  != 0 ) p_sys->i_width--;
 
-    vlc_mutex_init( &p_sys->lock );
-    p_sys->b_close = false;
     p_sys->i_effect = 0;
     p_sys->effect   = NULL;
 
@@ -321,16 +319,8 @@ static block_t *DoWork( filter_t *p_filter, block_t *p_in_buf )
     picture_t *p_outpic;
 
     /* First, get a new picture */
-    do
-    {
-        vlc_mutex_lock( &p_sys->lock );
-        bool close = p_sys->b_close;
-        vlc_mutex_unlock( &p_sys->lock );
-        if( close )
-            return NULL;
-        msleep( VOUT_OUTMEM_SLEEP );
-    }
     while( ( p_outpic = vout_GetPicture( p_sys->p_vout ) ) == NULL);
+        msleep( VOUT_OUTMEM_SLEEP );
 
     /* Blank the picture */
     for( int i = 0 ; i < p_outpic->i_planes ; i++ )
@@ -365,10 +355,6 @@ static void Close( vlc_object_t *p_this )
     filter_t * p_filter = (filter_t *)p_this;
     filter_sys_t *p_sys = p_filter->p_sys;
 
-    vlc_mutex_lock( &p_sys->lock );
-    p_sys->b_close = true;
-    vlc_mutex_unlock( &p_sys->lock );
-
     if( p_filter->p_sys->p_vout )
     {
         aout_filter_RequestVout( p_filter, p_filter->p_sys->p_vout, 0 );
@@ -402,6 +388,4 @@ static void Close( vlc_object_t *p_this )
 
     free( p_sys->effect );
     free( p_filter->p_sys );
-
-    vlc_mutex_destroy( &p_sys->lock );
 }
diff --git a/modules/visualization/visual/visual.h b/modules/visualization/visual/visual.h
index 8b79c7c..f0d0240 100644
--- a/modules/visualization/visual/visual.h
+++ b/modules/visualization/visual/visual.h
@@ -64,8 +64,6 @@ typedef struct
 struct filter_sys_t
 {
     vout_thread_t*  p_vout;
-    vlc_mutex_t     lock;
-    bool            b_close;
 
     int             i_width;
     int             i_height;



More information about the vlc-commits mailing list