Commit 1a14e109 authored by Antoine Cellerier's avatar Antoine Cellerier

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

parent f135a526
...@@ -312,6 +312,8 @@ void Close_LuaIntf( vlc_object_t *p_this ) ...@@ -312,6 +312,8 @@ void Close_LuaIntf( vlc_object_t *p_this )
intf_thread_t *p_intf = (intf_thread_t*)p_this; intf_thread_t *p_intf = (intf_thread_t*)p_this;
intf_sys_t *p_sys = p_intf->p_sys; intf_sys_t *p_sys = p_intf->p_sys;
vlc_cancel( p_sys->thread );
vlc_mutex_lock( &p_sys->lock ); vlc_mutex_lock( &p_sys->lock );
p_sys->exiting = true; p_sys->exiting = true;
vlc_cond_signal( &p_sys->wait ); vlc_cond_signal( &p_sys->wait );
......
...@@ -194,6 +194,7 @@ static int vlclua_net_poll( lua_State *L ) ...@@ -194,6 +194,7 @@ static int vlclua_net_poll( lua_State *L )
lua_pop( L, 1 ); lua_pop( L, 1 );
} }
struct pollfd *p_fds = malloc( i_fds * sizeof( struct pollfd ) ); struct pollfd *p_fds = malloc( i_fds * sizeof( struct pollfd ) );
vlc_cleanup_push( free, p_fds );
lua_pushnil( L ); lua_pushnil( L );
int i = 0; int i = 0;
while( lua_next( L, 1 ) ) while( lua_next( L, 1 ) )
...@@ -212,8 +213,8 @@ static int vlclua_net_poll( lua_State *L ) ...@@ -212,8 +213,8 @@ static int vlclua_net_poll( lua_State *L )
lua_pushinteger( L, p_fds[i].revents ); lua_pushinteger( L, p_fds[i].revents );
lua_settable( L, 1 ); lua_settable( L, 1 );
} }
free( p_fds );
lua_pushinteger( L, i_ret ); lua_pushinteger( L, i_ret );
vlc_cleanup_run();
return 1; return 1;
} }
......
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