[vlc-commits] luahttp: fix scope of url handler variables

Pierre Ynard git at videolan.org
Fri May 18 00:17:53 CEST 2012


vlc | branch: master | Pierre Ynard <linkfanel at yahoo.fr> | Fri May 18 00:05:02 2012 +0200| [97ec634439692b403f1ce0fc2e966bd3a5c06073] | committer: Pierre Ynard

luahttp: fix scope of url handler variables

The url handlers were declared with local scope, meaning local to the
lua script file I assume. Since the interface doesn't wait at the end
of the lua script anymore, they would fall out of scope after interface
initialization. Then, when the interface was first accessed, garbage
collection was somehow triggered, unregistering all url callbacks,
incidentally triggering a deadlock.

Fixes #6673

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

 share/lua/intf/http.lua |    6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/share/lua/intf/http.lua b/share/lua/intf/http.lua
index 65f2852..47e9651 100644
--- a/share/lua/intf/http.lua
+++ b/share/lua/intf/http.lua
@@ -38,7 +38,7 @@ open_tag = "<?vlc"
 close_tag = "?>"
 
 -- TODO: use internal VLC mime lookup function for mimes not included here
-local mimes = {
+mimes = {
     txt = "text/plain",
     json = "text/plain",
     html = "text/html",
@@ -277,7 +277,7 @@ do
     end
     package.path = oldpath
 end
-local files = {}
+files = {}
 local function load_dir(dir,root)
     local root = root or "/"
     local has_index = false
@@ -321,4 +321,4 @@ end
 password = vlc.var.inherit(nil,"http-password")
 h = vlc.httpd()
 load_dir( http_dir )
-local a = h:handler("/art",nil,password,callback_art,nil)
+a = h:handler("/art",nil,password,callback_art,nil)



More information about the vlc-commits mailing list