From 792b34686e5a092e0658b4c869fc739e5df55832 Mon Sep 17 00:00:00 2001 From: gfgtdf Date: Sun, 6 Jul 2014 17:23:46 +0200 Subject: [PATCH] fix assertion error on lua exceptions, lua uses c++ exceptions of type const lua_longjmp * internaly for lua exceptions. --- src/lua/ldo.cpp | 35 +++++++++++++++++++---------------- 1 file changed, 19 insertions(+), 16 deletions(-) diff --git a/src/lua/ldo.cpp b/src/lua/ldo.cpp index 92666b355366..859166c02d69 100644 --- a/src/lua/ldo.cpp +++ b/src/lua/ldo.cpp @@ -55,24 +55,27 @@ /* C++ exceptions */ #define LUAI_THROW(L,c) throw(c) #define LUAI_TRY(L,c,a) \ - try { \ - try { \ - a \ - } catch(const tlua_jailbreak_exception &e) { \ - e.store(); \ - throw; \ - } catch(const std::exception &e) { \ - lua_pushstring(L, e.what()); \ - luaG_errormsg(L); \ - throw; \ - } catch(...) { \ - assert(false && "Lua is swallowing an un-named exception... this indicates a programmer error, please derive all exceptions from std::exception!"); \ + try { \ + try { \ + a \ + } catch(const tlua_jailbreak_exception &e) { \ + e.store(); \ + throw; \ + } catch(const std::exception &e) { \ + lua_pushstring(L, e.what()); \ + luaG_errormsg(L); \ + throw; \ + } catch (const lua_longjmp *) { \ + /*this exception is used internaly by lua exceptions*/ \ + throw; \ + } catch(...) { \ + assert(false && "Lua is swallowing an un-named exception... this indicates a programmer error, please derive all exceptions from std::exception!"); \ throw; \ } \ - } catch(...) { \ - if((c)->status == 0) \ - (c)->status = -1;\ - } + } catch(...) { \ + if((c)->status == 0) \ + (c)->status = -1;\ + } #define luai_jmpbuf int /* dummy variable */