From 792bb0867ed88200d680b04e0f9fd2f2019415d0 Mon Sep 17 00:00:00 2001 From: Ilari Liusvaara Date: Wed, 28 Jan 2015 13:07:50 +0200 Subject: [PATCH] Lua: Don't lua_error() out of context with pending dtors MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit That likely would cause memory leaks. Also make a commit in order to tell apart rr2-β22b1 from rr2-β22. --- VERSION | 2 +- src/library/lua.cpp | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/VERSION b/VERSION index ab7eb49e..5edd496c 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -2-β22 +2-β22b1 diff --git a/src/library/lua.cpp b/src/library/lua.cpp index 329320f3..b83387bb 100644 --- a/src/library/lua.cpp +++ b/src/library/lua.cpp @@ -211,9 +211,9 @@ namespace state* lstate = reinterpret_cast(lua_touserdata(L, lua_upvalueindex(1))); void* _fn = lua_touserdata(L, lua_upvalueindex(2)); fn_t fn = (fn_t)_fn; - std::string name = lua_tostring(L, lua_upvalueindex(3)); - state _L(*lstate, L); try { + std::string name = lua_tostring(L, lua_upvalueindex(3)); + state _L(*lstate, L); parameters P(_L, name); return fn(_L, P); } catch(std::exception& e) { @@ -228,8 +228,8 @@ namespace void* ptr = lua_touserdata(L, lua_upvalueindex(1)); state* lstate = reinterpret_cast(lua_touserdata(L, lua_upvalueindex(2))); function* f = reinterpret_cast(ptr); - state _L(*lstate, L); try { + state _L(*lstate, L); return f->invoke(_L); } catch(std::exception& e) { lua_pushfstring(L, "%s", e.what()); -- 2.11.4.GIT