Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 7973 for code/branches


Ignore:
Timestamp:
Feb 26, 2011, 9:12:59 PM (14 years ago)
Author:
rgrieder
Message:

Fix for "error in error handling" when a Lua error occurs.
Untested and does not seem to be required by MSVC or Windows systems, so I cannot test. Please do so.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • code/branches/kicklib/src/libraries/core/GUIManager.cc

    r7971 r7973  
    4949#  include <CEGUILua.h>
    5050#  include <ogreceguirenderer/OgreCEGUIRenderer.h>
     51extern "C" {
     52#  include <lauxlib.h>
     53}
    5154#else
    5255#  include <ScriptingModules/LuaScriptModule/CEGUILua.h>
     
    102105    };
    103106
     107#ifdef ORXONOX_OLD_CEGUI
     108    /** Class with the same memory layout as CEGUI::LuaScriptModule. <br>
     109        We need this to fix a problem with an uninitialised member variable
     110        in CEGUI < 0.7 <br>
     111        Notice that "public" modifier for the otherwise private variables.
     112    */
     113    class CEGUILUA_API LuaScriptModuleWorkaround : public CEGUI::ScriptModule
     114    {
     115    public:
     116        LuaScriptModuleWorkaround();
     117        ~LuaScriptModuleWorkaround();
     118
     119    public:
     120        bool d_ownsState;
     121        lua_State* d_state;
     122        CEGUI::String d_errFuncName;
     123        int d_errFuncIndex;
     124        CEGUI::String d_activeErrFuncName;
     125        int d_activeErrFuncIndex;
     126    };
     127#endif
     128
    104129    static CEGUI::MouseButton convertButton(MouseButtonCode::ByEnum button);
    105130
     
    157182#ifdef ORXONOX_OLD_CEGUI
    158183        scriptModule_ = new LuaScriptModule(luaState_->getInternalLuaState());
     184        // Ugly workaround: older CEGUILua versions don't initialise the member
     185        // d_activeErrFuncIndex at all. That leads to "error in error handling"
     186        // problems when a Lua error occurs.
     187        // We fix this by setting the member manually.
     188        reinterpret_cast<LuaScriptModuleWorkaround*>(scriptModule_)->d_activeErrFuncIndex = LUA_NOREF;
    159189        luaState_->doString("ORXONOX_OLD_CEGUI = true");
    160190#else
Note: See TracChangeset for help on using the changeset viewer.