From: John L. <jr...@us...> - 2007-06-25 16:08:15
|
Update of /cvsroot/wxlua/wxLua/modules/wxbind/src In directory sc8-pr-cvs9.sourceforge.net:/tmp/cvs-serv9840/wxLua/modules/wxbind/src Modified Files: appframe.cpp Log Message: Allow the wxTaskBarIcon to be delete()ed since you have to in MSW for the program to exit Change the keys in the lua registry table to be lightuserdata to avoid collisions Display what the keys are in the registry table in the stack dialog Index: appframe.cpp =================================================================== RCS file: /cvsroot/wxlua/wxLua/modules/wxbind/src/appframe.cpp,v retrieving revision 1.60 retrieving revision 1.61 diff -C2 -d -r1.60 -r1.61 *** appframe.cpp 25 Jun 2007 03:19:40 -0000 1.60 --- appframe.cpp 25 Jun 2007 16:07:58 -0000 1.61 *************** *** 3312,3315 **** --- 3312,3331 ---- #endif // (wxLUA_USE_wxIcon) && (wxLUA_USE_wxTaskBarIcon && defined (wxHAS_TASK_BAR_ICON )) + static wxLuaArgTag s_wxluatagArray_wxLua_wxTaskBarIcon_delete[] = { &s_wxluatag_wxTaskBarIcon, NULL }; + static int LUACALL wxLua_wxTaskBarIcon_delete(lua_State *L); + static wxLuaBindCFunc s_wxluafunc_wxLua_wxTaskBarIcon_delete[1] = {{ wxLua_wxTaskBarIcon_delete, WXLUAMETHOD_METHOD|WXLUAMETHOD_DELETE, 1, 1, s_wxluatagArray_wxLua_wxTaskBarIcon_delete }}; + static int LUACALL wxLua_wxTaskBarIcon_delete(lua_State *L) + { + wxLuaState wxlState(L); + wxTaskBarIcon * self = (wxTaskBarIcon *)wxlState.GetUserDataType(1, s_wxluatag_wxTaskBarIcon); + // if removed from tracked mem list, reset the tag so that gc() is not called on this object. + if ((self != NULL) && wxlState.RemoveTrackedObject(self)) + { + lua_pushnil(L); + lua_setmetatable(L, -2); + } + return 0; + } + static int LUACALL wxLua_wxTaskBarIcon_constructor(lua_State *L); static wxLuaBindCFunc s_wxluafunc_wxLua_wxTaskBarIcon_constructor[1] = {{ wxLua_wxTaskBarIcon_constructor, WXLUAMETHOD_CONSTRUCTOR, 0, 0, s_wxluaargArray_None }}; *************** *** 3322,3327 **** // call constructor returns = new wxTaskBarIcon(); ! // add to tracked window list, it will check validity ! wxlState.AddTrackedWindow(returns); // push the constructed class pointer wxlState.PushUserDataType(s_wxluatag_wxTaskBarIcon, returns); --- 3338,3343 ---- // call constructor returns = new wxTaskBarIcon(); ! // add to tracked memory list ! wxlState.AddTrackedObject(returns); // push the constructed class pointer wxlState.PushUserDataType(s_wxluatag_wxTaskBarIcon, returns); *************** *** 3347,3350 **** --- 3363,3367 ---- #endif // (wxLUA_USE_wxIcon) && (wxLUA_USE_wxTaskBarIcon && defined (wxHAS_TASK_BAR_ICON )) + { "delete", WXLUAMETHOD_METHOD|WXLUAMETHOD_DELETE, s_wxluafunc_wxLua_wxTaskBarIcon_delete, 1, NULL }, { "wxTaskBarIcon", WXLUAMETHOD_CONSTRUCTOR, s_wxluafunc_wxLua_wxTaskBarIcon_constructor, 1, NULL }, |