[Orxonox-commit 2044] r6761 - code/trunk/src/external/ceguilua/ceguilua-0.6.2/ceguilua
rgrieder at orxonox.net
rgrieder at orxonox.net
Mon Apr 19 16:49:12 CEST 2010
Author: rgrieder
Date: 2010-04-19 16:49:11 +0200 (Mon, 19 Apr 2010)
New Revision: 6761
Modified:
code/trunk/src/external/ceguilua/ceguilua-0.6.2/ceguilua/CEGUILua.cpp
code/trunk/src/external/ceguilua/ceguilua-0.6.2/ceguilua/CEGUILuaFunctor.cpp
Log:
Fixed "error in error handler" problem that occurred within CEGUILua scripted events (like clicking on a button).
Initialising values is always a good idea...
Also fixed a potential bug: not removing the error handler from the Lua stack can be very dangerous as I had to find out lately..
Modified: code/trunk/src/external/ceguilua/ceguilua-0.6.2/ceguilua/CEGUILua.cpp
===================================================================
--- code/trunk/src/external/ceguilua/ceguilua-0.6.2/ceguilua/CEGUILua.cpp 2010-04-19 14:35:30 UTC (rev 6760)
+++ code/trunk/src/external/ceguilua/ceguilua-0.6.2/ceguilua/CEGUILua.cpp 2010-04-19 14:49:11 UTC (rev 6761)
@@ -55,7 +55,8 @@
Constructor (creates Lua state)
*************************************************************************/
LuaScriptModule::LuaScriptModule() :
- d_errFuncIndex(LUA_NOREF)
+ d_errFuncIndex(LUA_NOREF),
+ d_activeErrFuncIndex(LUA_NOREF)
{
#if LUA_VERSION_NUM >= 501
static const luaL_Reg lualibs[] = {
@@ -104,7 +105,9 @@
/*************************************************************************
Constructor (uses given Lua state)
*************************************************************************/
-LuaScriptModule::LuaScriptModule(lua_State* state)
+LuaScriptModule::LuaScriptModule(lua_State* state) :
+ d_errFuncIndex(LUA_NOREF),
+ d_activeErrFuncIndex(LUA_NOREF)
{
// just use the given state
d_ownsState = false;
Modified: code/trunk/src/external/ceguilua/ceguilua-0.6.2/ceguilua/CEGUILuaFunctor.cpp
===================================================================
--- code/trunk/src/external/ceguilua/ceguilua-0.6.2/ceguilua/CEGUILuaFunctor.cpp 2010-04-19 14:35:30 UTC (rev 6760)
+++ code/trunk/src/external/ceguilua/ceguilua-0.6.2/ceguilua/CEGUILuaFunctor.cpp 2010-04-19 14:49:11 UTC (rev 6761)
@@ -199,6 +199,10 @@
bool ret = lua_isboolean(L, -1) ? lua_toboolean(L, -1 ) : true;
lua_pop(L, 1);
+ // remove error handler from stack
+ if (err_idx != 0)
+ lua_remove(L, err_idx);
+
if(helper)
{
delete helper;
More information about the Orxonox-commit
mailing list