[vlc-devel] commit: Fix lua intf thread cancellation and cleanup properly in vlc.net. poll(). (Antoine Cellerier )

git version control git at videolan.org
Sat Feb 6 14:47:54 CET 2010


vlc | branch: master | Antoine Cellerier <dionoea at videolan.org> | Sat Feb  6 14:45:09 2010 +0100| [1a14e109516fee0ac5eb55b75e6d11828abf3fbb] | committer: Antoine Cellerier 

Fix lua intf thread cancellation and cleanup properly in vlc.net.poll().

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

 modules/misc/lua/intf.c     |    2 ++
 modules/misc/lua/libs/net.c |    3 ++-
 2 files changed, 4 insertions(+), 1 deletions(-)

diff --git a/modules/misc/lua/intf.c b/modules/misc/lua/intf.c
index 9c8c64b..7a80ef4 100644
--- a/modules/misc/lua/intf.c
+++ b/modules/misc/lua/intf.c
@@ -312,6 +312,8 @@ void Close_LuaIntf( vlc_object_t *p_this )
     intf_thread_t *p_intf = (intf_thread_t*)p_this;
     intf_sys_t *p_sys = p_intf->p_sys;
 
+    vlc_cancel( p_sys->thread );
+
     vlc_mutex_lock( &p_sys->lock );
     p_sys->exiting = true;
     vlc_cond_signal( &p_sys->wait );
diff --git a/modules/misc/lua/libs/net.c b/modules/misc/lua/libs/net.c
index eb56a95..68b875f 100644
--- a/modules/misc/lua/libs/net.c
+++ b/modules/misc/lua/libs/net.c
@@ -194,6 +194,7 @@ static int vlclua_net_poll( lua_State *L )
         lua_pop( L, 1 );
     }
     struct pollfd *p_fds = malloc( i_fds * sizeof( struct pollfd ) );
+    vlc_cleanup_push( free, p_fds );
     lua_pushnil( L );
     int i = 0;
     while( lua_next( L, 1 ) )
@@ -212,8 +213,8 @@ static int vlclua_net_poll( lua_State *L )
         lua_pushinteger( L, p_fds[i].revents );
         lua_settable( L, 1 );
     }
-    free( p_fds );
     lua_pushinteger( L, i_ret );
+    vlc_cleanup_run();
     return 1;
 }
 




More information about the vlc-devel mailing list