]> git.sesse.net Git - vlc/blobdiff - modules/lua/intf.c
lua: raise an erro from net.poll() when quitting
[vlc] / modules / lua / intf.c
index 32fe851a7300b416a5eb00060a00e71445b83ace..6e34caf70aa5e26824b3c01035b01a6e8650426a 100644 (file)
@@ -33,6 +33,7 @@
 
 #include <vlc_common.h>
 #include <vlc_interface.h>
+#include <vlc_fs.h>
 
 #include "vlc.h"
 #include "libs.h"
@@ -360,8 +361,16 @@ static int Start_LuaIntf( vlc_object_t *p_this, const char *name )
 
     p_sys->L = L;
 
+    if( vlc_pipe( p_sys->fd ) )
+    {
+        lua_close( p_sys->L );
+        goto error;
+    }
+
     if( vlc_clone( &p_sys->thread, Run, p_intf, VLC_THREAD_PRIORITY_LOW ) )
     {
+        close( p_sys->fd[1] );
+        close( p_sys->fd[0] );
         lua_close( p_sys->L );
         goto error;
     }
@@ -380,9 +389,11 @@ 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;
 
+    close( p_sys->fd[1] );
     vlc_join( p_sys->thread, NULL );
-    lua_close( p_sys->L );
 
+    lua_close( p_sys->L );
+    close( p_sys->fd[0] );
     free( p_sys->psz_filename );
     free( p_sys );
 }