Update of /cvsroot/wxlua/wxLua/modules/wxbind/src In directory sc8-pr-cvs9.sourceforge.net:/tmp/cvs-serv15657/wxLua/modules/wxbind/src Modified Files: appframe.cpp clipdrag.cpp config.cpp controls.cpp data.cpp datetime.cpp defsutil.cpp dialogs.cpp event.cpp file.cpp gdi.cpp geometry.cpp grid.cpp help.cpp html.cpp image.cpp mdi.cpp menutool.cpp print.cpp regex.cpp sizer.cpp socket.cpp thread.cpp wave.cpp windows.cpp wx_bind.cpp wxlua.cpp xml.cpp Log Message: Remove wxLua_AddTrackedObject functions and just use wxLuaState::AddTrackedObject directly Remove all gc (destructor, LuaDelete) functions from the methods of a class since we can delete the objects in the single gc function in wxlbind.cpp anyway. Index: xml.cpp =================================================================== RCS file: /cvsroot/wxlua/wxLua/modules/wxbind/src/xml.cpp,v retrieving revision 1.24 retrieving revision 1.25 diff -C2 -d -r1.24 -r1.25 *** xml.cpp 9 Mar 2007 00:15:18 -0000 1.24 --- xml.cpp 15 Mar 2007 00:01:24 -0000 1.25 *************** *** 43,47 **** returns = new wxXmlNode(); // add to tracked memory list ! wxLua_AddTrackedObject(wxlState, (wxXmlNode *)returns); // push the constructed class pointer wxlState.PushUserDataType(s_wxluatag_wxXmlNode, returns); --- 43,47 ---- returns = new wxXmlNode(); // add to tracked memory list ! wxlState.AddTrackedObject((long)returns, new wxObject_wxXmlNode((wxXmlNode *)returns)); // push the constructed class pointer wxlState.PushUserDataType(s_wxluatag_wxXmlNode, returns); *************** *** 67,71 **** returns = new wxXmlNode(type, name, content); // add to tracked memory list ! wxLua_AddTrackedObject(wxlState, (wxXmlNode *)returns); // push the constructed class pointer wxlState.PushUserDataType(s_wxluatag_wxXmlNode, returns); --- 67,71 ---- returns = new wxXmlNode(type, name, content); // add to tracked memory list ! wxlState.AddTrackedObject((long)returns, new wxObject_wxXmlNode((wxXmlNode *)returns)); // push the constructed class pointer wxlState.PushUserDataType(s_wxluatag_wxXmlNode, returns); *************** *** 95,99 **** returns = new wxXmlNode(parent, type, name, content, props, next); // add to tracked memory list ! wxLua_AddTrackedObject(wxlState, (wxXmlNode *)returns); // push the constructed class pointer wxlState.PushUserDataType(s_wxluatag_wxXmlNode, returns); --- 95,99 ---- returns = new wxXmlNode(parent, type, name, content, props, next); // add to tracked memory list ! wxlState.AddTrackedObject((long)returns, new wxObject_wxXmlNode((wxXmlNode *)returns)); // push the constructed class pointer wxlState.PushUserDataType(s_wxluatag_wxXmlNode, returns); *************** *** 473,498 **** } - static int LUACALL wxLua_wxXmlNode_destructor(lua_State *L) - { - wxLuaState wxlState(L); - wxXmlNode * self = (wxXmlNode *)wxlState.GetUserDataType(1, s_wxluatag_wxXmlNode); - - // remove from tracked memory list - if (self != 0) - wxlState.RemoveTrackedObject(self); - return 0; - } - static int LUACALL wxLua_wxXmlNode_Delete(lua_State *L) { wxLuaState wxlState(L); wxXmlNode * self = (wxXmlNode *)wxlState.GetUserDataType(1, s_wxluatag_wxXmlNode); ! // remove from tracked memory list ! if (self != 0) ! if (wxlState.RemoveTrackedObject(self)) ! { // if removed, reset the tag so that gc() is not called on this object. ! lua_pushnil(L); ! lua_setmetatable(L, -2); ! } return 0; } --- 473,486 ---- } static int LUACALL wxLua_wxXmlNode_Delete(lua_State *L) { wxLuaState wxlState(L); wxXmlNode * self = (wxXmlNode *)wxlState.GetUserDataType(1, s_wxluatag_wxXmlNode); ! // 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; } *************** *** 542,546 **** { LuaGetProp, "Type", wxLua_wxXmlNode_GetType, 0, 0, s_wxluaargArray_None }, { LuaSetProp, "Type", wxLua_wxXmlNode_SetType, 1, 1, s_wxluaargArray_None }, - { LuaDelete, "wxXmlNode", wxLua_wxXmlNode_destructor, 0, 0, s_wxluaargArray_None }, { LuaMethod, "Delete", wxLua_wxXmlNode_Delete, 0, 0, s_wxluaargArray_None }, }; --- 530,533 ---- *************** *** 573,577 **** returns = new wxXmlProperty(name, value, next); // add to tracked memory list ! wxLua_AddTrackedObject(wxlState, (wxXmlProperty *)returns); // push the constructed class pointer wxlState.PushUserDataType(s_wxluatag_wxXmlProperty, returns); --- 560,564 ---- returns = new wxXmlProperty(name, value, next); // add to tracked memory list ! wxlState.AddTrackedObject((long)returns, new wxObject_wxXmlProperty((wxXmlProperty *)returns)); // push the constructed class pointer wxlState.PushUserDataType(s_wxluatag_wxXmlProperty, returns); *************** *** 588,592 **** returns = new wxXmlProperty(); // add to tracked memory list ! wxLua_AddTrackedObject(wxlState, (wxXmlProperty *)returns); // push the constructed class pointer wxlState.PushUserDataType(s_wxluatag_wxXmlProperty, returns); --- 575,579 ---- returns = new wxXmlProperty(); // add to tracked memory list ! wxlState.AddTrackedObject((long)returns, new wxObject_wxXmlProperty((wxXmlProperty *)returns)); // push the constructed class pointer wxlState.PushUserDataType(s_wxluatag_wxXmlProperty, returns); *************** *** 685,710 **** } - static int LUACALL wxLua_wxXmlProperty_destructor(lua_State *L) - { - wxLuaState wxlState(L); - wxXmlProperty * self = (wxXmlProperty *)wxlState.GetUserDataType(1, s_wxluatag_wxXmlProperty); - - // remove from tracked memory list - if (self != 0) - wxlState.RemoveTrackedObject(self); - return 0; - } - static int LUACALL wxLua_wxXmlProperty_Delete(lua_State *L) { wxLuaState wxlState(L); wxXmlProperty * self = (wxXmlProperty *)wxlState.GetUserDataType(1, s_wxluatag_wxXmlProperty); ! // remove from tracked memory list ! if (self != 0) ! if (wxlState.RemoveTrackedObject(self)) ! { // if removed, reset the tag so that gc() is not called on this object. ! lua_pushnil(L); ! lua_setmetatable(L, -2); ! } return 0; } --- 672,685 ---- } static int LUACALL wxLua_wxXmlProperty_Delete(lua_State *L) { wxLuaState wxlState(L); wxXmlProperty * self = (wxXmlProperty *)wxlState.GetUserDataType(1, s_wxluatag_wxXmlProperty); ! // 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; } *************** *** 728,732 **** { LuaGetProp, "Next", wxLua_wxXmlProperty_GetNext, 0, 0, s_wxluaargArray_None }, { LuaSetProp, "Next", wxLua_wxXmlProperty_SetNext, 1, 1, s_wxluaargArray_None }, - { LuaDelete, "wxXmlProperty", wxLua_wxXmlProperty_destructor, 0, 0, s_wxluaargArray_None }, { LuaMethod, "Delete", wxLua_wxXmlProperty_Delete, 0, 0, s_wxluaargArray_None }, }; --- 703,706 ---- *************** *** 752,756 **** returns = new wxXmlDocument(); // add to tracked memory list ! wxLua_AddTrackedObject(wxlState, (wxXmlDocument *)returns); // push the constructed class pointer wxlState.PushUserDataType(s_wxluatag_wxXmlDocument, returns); --- 726,730 ---- returns = new wxXmlDocument(); // add to tracked memory list ! wxlState.AddTrackedObject((wxXmlDocument *)returns); // push the constructed class pointer wxlState.PushUserDataType(s_wxluatag_wxXmlDocument, returns); *************** *** 774,778 **** returns = new wxXmlDocument(filename, encoding); // add to tracked memory list ! wxLua_AddTrackedObject(wxlState, (wxXmlDocument *)returns); // push the constructed class pointer wxlState.PushUserDataType(s_wxluatag_wxXmlDocument, returns); --- 748,752 ---- returns = new wxXmlDocument(filename, encoding); // add to tracked memory list ! wxlState.AddTrackedObject((wxXmlDocument *)returns); // push the constructed class pointer wxlState.PushUserDataType(s_wxluatag_wxXmlDocument, returns); *************** *** 926,951 **** } - static int LUACALL wxLua_wxXmlDocument_destructor(lua_State *L) - { - wxLuaState wxlState(L); - wxXmlDocument * self = (wxXmlDocument *)wxlState.GetUserDataType(1, s_wxluatag_wxXmlDocument); - - // remove from tracked memory list - if (self != 0) - wxlState.RemoveTrackedObject(self); - return 0; - } - static int LUACALL wxLua_wxXmlDocument_Delete(lua_State *L) { wxLuaState wxlState(L); wxXmlDocument * self = (wxXmlDocument *)wxlState.GetUserDataType(1, s_wxluatag_wxXmlDocument); ! // remove from tracked memory list ! if (self != 0) ! if (wxlState.RemoveTrackedObject(self)) ! { // if removed, reset the tag so that gc() is not called on this object. ! lua_pushnil(L); ! lua_setmetatable(L, -2); ! } return 0; } --- 900,913 ---- } static int LUACALL wxLua_wxXmlDocument_Delete(lua_State *L) { wxLuaState wxlState(L); wxXmlDocument * self = (wxXmlDocument *)wxlState.GetUserDataType(1, s_wxluatag_wxXmlDocument); ! // 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; } *************** *** 972,976 **** { LuaGetProp, "FileEncoding", wxLua_wxXmlDocument_GetFileEncoding, 0, 0, s_wxluaargArray_None }, { LuaSetProp, "FileEncoding", wxLua_wxXmlDocument_SetFileEncoding, 1, 1, s_wxluaargArray_None }, - { LuaDelete, "wxXmlDocument", wxLua_wxXmlDocument_destructor, 0, 0, s_wxluaargArray_None }, { LuaMethod, "Delete", wxLua_wxXmlDocument_Delete, 0, 0, s_wxluaargArray_None }, }; --- 934,937 ---- *************** *** 988,1001 **** int s_wxluatag_wxXmlResourceHandler = -1; - static int LUACALL wxLua_wxXmlResourceHandler_destructor(lua_State *) - { - return 0; - } - // Map Lua Class Methods to C Binding Functions WXLUAMETHOD wxXmlResourceHandler_methods[] = { - { LuaDelete, "wxXmlResourceHandler", wxLua_wxXmlResourceHandler_destructor, 0, 0, s_wxluaargArray_None }, }; --- 949,956 ---- *************** *** 1028,1032 **** returns = new wxBitmap(self->LoadBitmap(name)); // add the new object to the tracked memory list ! wxLua_AddTrackedObject(wxlState, (wxBitmap *)returns); // push the result datatype wxlState.PushUserDataType(s_wxluatag_wxBitmap, returns); --- 983,987 ---- returns = new wxBitmap(self->LoadBitmap(name)); // add the new object to the tracked memory list ! wxlState.AddTrackedObject((wxBitmap *)returns); // push the result datatype wxlState.PushUserDataType(s_wxluatag_wxBitmap, returns); *************** *** 1177,1181 **** returns = new wxIcon(self->LoadIcon(name)); // add the new object to the tracked memory list ! wxLua_AddTrackedObject(wxlState, (wxIcon *)returns); // push the result datatype wxlState.PushUserDataType(s_wxluatag_wxIcon, returns); --- 1132,1136 ---- returns = new wxIcon(self->LoadIcon(name)); // add the new object to the tracked memory list ! wxlState.AddTrackedObject((wxIcon *)returns); // push the result datatype wxlState.PushUserDataType(s_wxluatag_wxIcon, returns); *************** *** 1285,1289 **** returns = new wxXmlResource(filemask, flags); // add to tracked memory list ! wxLua_AddTrackedObject(wxlState, (wxXmlResource *)returns); // push the constructed class pointer wxlState.PushUserDataType(s_wxluatag_wxXmlResource, returns); --- 1240,1244 ---- returns = new wxXmlResource(filemask, flags); // add to tracked memory list ! wxlState.AddTrackedObject((wxXmlResource *)returns); // push the constructed class pointer wxlState.PushUserDataType(s_wxluatag_wxXmlResource, returns); *************** *** 1319,1323 **** returns = new wxXmlResource(flags); // add to tracked memory list ! wxLua_AddTrackedObject(wxlState, (wxXmlResource *)returns); // push the constructed class pointer wxlState.PushUserDataType(s_wxluatag_wxXmlResource, returns); --- 1274,1278 ---- returns = new wxXmlResource(flags); // add to tracked memory list ! wxlState.AddTrackedObject((wxXmlResource *)returns); // push the constructed class pointer wxlState.PushUserDataType(s_wxluatag_wxXmlResource, returns); *************** *** 1569,1594 **** } - static int LUACALL wxLua_wxXmlResource_destructor(lua_State *L) - { - wxLuaState wxlState(L); - wxXmlResource * self = (wxXmlResource *)wxlState.GetUserDataType(1, s_wxluatag_wxXmlResource); - - // remove from tracked memory list - if (self != 0) - wxlState.RemoveTrackedObject(self); - return 0; - } - static int LUACALL wxLua_wxXmlResource_Delete(lua_State *L) { wxLuaState wxlState(L); wxXmlResource * self = (wxXmlResource *)wxlState.GetUserDataType(1, s_wxluatag_wxXmlResource); ! // remove from tracked memory list ! if (self != 0) ! if (wxlState.RemoveTrackedObject(self)) ! { // if removed, reset the tag so that gc() is not called on this object. ! lua_pushnil(L); ! lua_setmetatable(L, -2); ! } return 0; } --- 1524,1537 ---- } static int LUACALL wxLua_wxXmlResource_Delete(lua_State *L) { wxLuaState wxlState(L); wxXmlResource * self = (wxXmlResource *)wxlState.GetUserDataType(1, s_wxluatag_wxXmlResource); ! // 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; } *************** *** 1652,1656 **** { LuaGetProp, "Flags", wxLua_wxXmlResource_GetFlags, 0, 0, s_wxluaargArray_None }, { LuaGetProp, "Version", wxLua_wxXmlResource_GetVersion, 0, 0, s_wxluaargArray_None }, - { LuaDelete, "wxXmlResource", wxLua_wxXmlResource_destructor, 0, 0, s_wxluaargArray_None }, { LuaMethod, "Delete", wxLua_wxXmlResource_Delete, 0, 0, s_wxluaargArray_None }, }; --- 1595,1598 ---- Index: defsutil.cpp =================================================================== RCS file: /cvsroot/wxlua/wxLua/modules/wxbind/src/defsutil.cpp,v retrieving revision 1.26 retrieving revision 1.27 diff -C2 -d -r1.26 -r1.27 *** defsutil.cpp 9 Mar 2007 00:15:14 -0000 1.26 --- defsutil.cpp 15 Mar 2007 00:01:16 -0000 1.27 *************** *** 179,183 **** returns = new wxProcess(parent, nId); // add to tracked memory list ! wxLua_AddTrackedObject(wxlState, (wxProcess *)returns); // push the constructed class pointer wxlState.PushUserDataType(s_wxluatag_wxProcess, returns); --- 179,183 ---- returns = new wxProcess(parent, nId); // add to tracked memory list ! wxlState.AddTrackedObject((long)returns, new wxObject_wxProcess((wxProcess *)returns)); // push the constructed class pointer wxlState.PushUserDataType(s_wxluatag_wxProcess, returns); *************** *** 283,308 **** } - static int LUACALL wxLua_wxProcess_destructor(lua_State *L) - { - wxLuaState wxlState(L); - wxProcess * self = (wxProcess *)wxlState.GetUserDataType(1, s_wxluatag_wxProcess); - - // remove from tracked memory list - if (self != 0) - wxlState.RemoveTrackedObject(self); - return 0; - } - static int LUACALL wxLua_wxProcess_Delete(lua_State *L) { wxLuaState wxlState(L); wxProcess * self = (wxProcess *)wxlState.GetUserDataType(1, s_wxluatag_wxProcess); ! // remove from tracked memory list ! if (self != 0) ! if (wxlState.RemoveTrackedObject(self)) ! { // if removed, reset the tag so that gc() is not called on this object. ! lua_pushnil(L); ! lua_setmetatable(L, -2); ! } return 0; } --- 283,296 ---- } static int LUACALL wxLua_wxProcess_Delete(lua_State *L) { wxLuaState wxlState(L); wxProcess * self = (wxProcess *)wxlState.GetUserDataType(1, s_wxluatag_wxProcess); ! // 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; } *************** *** 335,339 **** { LuaMethod, "Redirect", wxLua_wxProcess_Redirect, 0, 0, s_wxluaargArray_None }, { LuaMethod, "IsRedirected", wxLua_wxProcess_IsRedirected, 0, 0, s_wxluaargArray_None }, - { LuaDelete, "wxProcess", wxLua_wxProcess_destructor, 0, 0, s_wxluaargArray_None }, { LuaMethod, "Delete", wxLua_wxProcess_Delete, 0, 0, s_wxluaargArray_None }, }; --- 323,326 ---- *************** *** 359,363 **** returns = new wxMouseState(); // add to tracked memory list ! wxLua_AddTrackedObject(wxlState, (wxMouseState *)returns); // push the constructed class pointer wxlState.PushUserDataType(s_wxluatag_wxMouseState, returns); --- 346,350 ---- returns = new wxMouseState(); // add to tracked memory list ! wxlState.AddTrackedObject((long)returns, new wxObject_wxMouseState((wxMouseState *)returns)); // push the constructed class pointer wxlState.PushUserDataType(s_wxluatag_wxMouseState, returns); *************** *** 651,676 **** } - static int LUACALL wxLua_wxMouseState_destructor(lua_State *L) - { - wxLuaState wxlState(L); - wxMouseState * self = (wxMouseState *)wxlState.GetUserDataType(1, s_wxluatag_wxMouseState); - - // remove from tracked memory list - if (self != 0) - wxlState.RemoveTrackedObject(self); - return 0; - } - static int LUACALL wxLua_wxMouseState_Delete(lua_State *L) { wxLuaState wxlState(L); wxMouseState * self = (wxMouseState *)wxlState.GetUserDataType(1, s_wxluatag_wxMouseState); ! // remove from tracked memory list ! if (self != 0) ! if (wxlState.RemoveTrackedObject(self)) ! { // if removed, reset the tag so that gc() is not called on this object. ! lua_pushnil(L); ! lua_setmetatable(L, -2); ! } return 0; } --- 638,651 ---- } static int LUACALL wxLua_wxMouseState_Delete(lua_State *L) { wxLuaState wxlState(L); wxMouseState * self = (wxMouseState *)wxlState.GetUserDataType(1, s_wxluatag_wxMouseState); ! // 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; } *************** *** 700,704 **** { LuaMethod, "SetAltDown", wxLua_wxMouseState_SetAltDown, 1, 1, s_wxluatagArray_wxLua_wxMouseState_SetAltDown }, { LuaMethod, "SetMetaDown", wxLua_wxMouseState_SetMetaDown, 1, 1, s_wxluatagArray_wxLua_wxMouseState_SetMetaDown }, - { LuaDelete, "wxMouseState", wxLua_wxMouseState_destructor, 0, 0, s_wxluaargArray_None }, { LuaMethod, "Delete", wxLua_wxMouseState_Delete, 0, 0, s_wxluaargArray_None }, }; --- 675,678 ---- *************** *** 734,738 **** returns = new wxBusyCursor(cursor); // add to tracked memory list ! wxLua_AddTrackedObject(wxlState, (wxBusyCursor *)returns); // push the constructed class pointer wxlState.PushUserDataType(s_wxluatag_wxBusyCursor, returns); --- 708,712 ---- returns = new wxBusyCursor(cursor); // add to tracked memory list ! wxlState.AddTrackedObject((long)returns, new wxObject_wxBusyCursor((wxBusyCursor *)returns)); // push the constructed class pointer wxlState.PushUserDataType(s_wxluatag_wxBusyCursor, returns); *************** *** 743,768 **** #endif // (wxLUA_USE_wxBusyCursor) && (wxLUA_USE_wxCursor) - static int LUACALL wxLua_wxBusyCursor_destructor(lua_State *L) - { - wxLuaState wxlState(L); - wxBusyCursor * self = (wxBusyCursor *)wxlState.GetUserDataType(1, s_wxluatag_wxBusyCursor); - - // remove from tracked memory list - if (self != 0) - wxlState.RemoveTrackedObject(self); - return 0; - } - static int LUACALL wxLua_wxBusyCursor_Delete(lua_State *L) { wxLuaState wxlState(L); wxBusyCursor * self = (wxBusyCursor *)wxlState.GetUserDataType(1, s_wxluatag_wxBusyCursor); ! // remove from tracked memory list ! if (self != 0) ! if (wxlState.RemoveTrackedObject(self)) ! { // if removed, reset the tag so that gc() is not called on this object. ! lua_pushnil(L); ! lua_setmetatable(L, -2); ! } return 0; } --- 717,730 ---- #endif // (wxLUA_USE_wxBusyCursor) && (wxLUA_USE_wxCursor) static int LUACALL wxLua_wxBusyCursor_Delete(lua_State *L) { wxLuaState wxlState(L); wxBusyCursor * self = (wxBusyCursor *)wxlState.GetUserDataType(1, s_wxluatag_wxBusyCursor); ! // 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; } *************** *** 777,781 **** #endif // (wxLUA_USE_wxBusyCursor) && (wxLUA_USE_wxCursor) - { LuaDelete, "wxBusyCursor", wxLua_wxBusyCursor_destructor, 0, 0, s_wxluaargArray_None }, { LuaMethod, "Delete", wxLua_wxBusyCursor_Delete, 0, 0, s_wxluaargArray_None }, }; --- 739,742 ---- *************** *** 801,805 **** returns = new wxBusyCursorSuspender(); // add to tracked memory list ! wxLua_AddTrackedObject(wxlState, (wxBusyCursorSuspender *)returns); // push the constructed class pointer wxlState.PushUserDataType(s_wxluatag_wxBusyCursorSuspender, returns); --- 762,766 ---- returns = new wxBusyCursorSuspender(); // add to tracked memory list ! wxlState.AddTrackedObject((long)returns, new wxObject_wxBusyCursorSuspender((wxBusyCursorSuspender *)returns)); // push the constructed class pointer wxlState.PushUserDataType(s_wxluatag_wxBusyCursorSuspender, returns); *************** *** 808,833 **** } - static int LUACALL wxLua_wxBusyCursorSuspender_destructor(lua_State *L) - { - wxLuaState wxlState(L); - wxBusyCursorSuspender * self = (wxBusyCursorSuspender *)wxlState.GetUserDataType(1, s_wxluatag_wxBusyCursorSuspender); - - // remove from tracked memory list - if (self != 0) - wxlState.RemoveTrackedObject(self); - return 0; - } - static int LUACALL wxLua_wxBusyCursorSuspender_Delete(lua_State *L) { wxLuaState wxlState(L); wxBusyCursorSuspender * self = (wxBusyCursorSuspender *)wxlState.GetUserDataType(1, s_wxluatag_wxBusyCursorSuspender); ! // remove from tracked memory list ! if (self != 0) ! if (wxlState.RemoveTrackedObject(self)) ! { // if removed, reset the tag so that gc() is not called on this object. ! lua_pushnil(L); ! lua_setmetatable(L, -2); ! } return 0; } --- 769,782 ---- } static int LUACALL wxLua_wxBusyCursorSuspender_Delete(lua_State *L) { wxLuaState wxlState(L); wxBusyCursorSuspender * self = (wxBusyCursorSuspender *)wxlState.GetUserDataType(1, s_wxluatag_wxBusyCursorSuspender); ! // 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; } *************** *** 838,842 **** WXLUAMETHOD wxBusyCursorSuspender_methods[] = { { LuaConstructor, "wxBusyCursorSuspender", wxLua_wxBusyCursorSuspender_constructor, 0, 0, s_wxluaargArray_None }, - { LuaDelete, "wxBusyCursorSuspender", wxLua_wxBusyCursorSuspender_destructor, 0, 0, s_wxluaargArray_None }, { LuaMethod, "Delete", wxLua_wxBusyCursorSuspender_Delete, 0, 0, s_wxluaargArray_None }, }; --- 787,790 ---- *************** *** 869,873 **** returns = new wxBusyInfo(message, parent); // add to tracked memory list ! wxLua_AddTrackedObject(wxlState, (wxBusyInfo *)returns); // push the constructed class pointer wxlState.PushUserDataType(s_wxluatag_wxBusyInfo, returns); --- 817,821 ---- returns = new wxBusyInfo(message, parent); // add to tracked memory list ! wxlState.AddTrackedObject((wxBusyInfo *)returns); // push the constructed class pointer wxlState.PushUserDataType(s_wxluatag_wxBusyInfo, returns); *************** *** 876,901 **** } - static int LUACALL wxLua_wxBusyInfo_destructor(lua_State *L) - { - wxLuaState wxlState(L); - wxBusyInfo * self = (wxBusyInfo *)wxlState.GetUserDataType(1, s_wxluatag_wxBusyInfo); - - // remove from tracked memory list - if (self != 0) - wxlState.RemoveTrackedObject(self); - return 0; - } - static int LUACALL wxLua_wxBusyInfo_Delete(lua_State *L) { wxLuaState wxlState(L); wxBusyInfo * self = (wxBusyInfo *)wxlState.GetUserDataType(1, s_wxluatag_wxBusyInfo); ! // remove from tracked memory list ! if (self != 0) ! if (wxlState.RemoveTrackedObject(self)) ! { // if removed, reset the tag so that gc() is not called on this object. ! lua_pushnil(L); ! lua_setmetatable(L, -2); ! } return 0; } --- 824,837 ---- } static int LUACALL wxLua_wxBusyInfo_Delete(lua_State *L) { wxLuaState wxlState(L); wxBusyInfo * self = (wxBusyInfo *)wxlState.GetUserDataType(1, s_wxluatag_wxBusyInfo); ! // 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; } *************** *** 906,910 **** WXLUAMETHOD wxBusyInfo_methods[] = { { LuaConstructor, "wxBusyInfo", wxLua_wxBusyInfo_constructor, 2, 1, s_wxluatagArray_wxLua_wxBusyInfo_constructor }, - { LuaDelete, "wxBusyInfo", wxLua_wxBusyInfo_destructor, 0, 0, s_wxluaargArray_None }, { LuaMethod, "Delete", wxLua_wxBusyInfo_Delete, 0, 0, s_wxluaargArray_None }, }; --- 842,845 ---- Index: wxlua.cpp =================================================================== RCS file: /cvsroot/wxlua/wxLua/modules/wxbind/src/wxlua.cpp,v retrieving revision 1.30 retrieving revision 1.31 diff -C2 -d -r1.30 -r1.31 *** wxlua.cpp 9 Mar 2007 00:15:18 -0000 1.30 --- wxlua.cpp 15 Mar 2007 00:01:24 -0000 1.31 *************** *** 33,58 **** int s_wxluatag_wxLuaState = -1; - static int LUACALL wxLua_wxLuaState_destructor(lua_State *L) - { - wxLuaState wxlState(L); - wxLuaState * self = (wxLuaState *)wxlState.GetUserDataType(1, s_wxluatag_wxLuaState); - - // remove from tracked memory list - if (self != 0) - wxlState.RemoveTrackedObject(self); - return 0; - } - static int LUACALL wxLua_wxLuaState_Delete(lua_State *L) { wxLuaState wxlState(L); wxLuaState * self = (wxLuaState *)wxlState.GetUserDataType(1, s_wxluatag_wxLuaState); ! // remove from tracked memory list ! if (self != 0) ! if (wxlState.RemoveTrackedObject(self)) ! { // if removed, reset the tag so that gc() is not called on this object. ! lua_pushnil(L); ! lua_setmetatable(L, -2); ! } return 0; } --- 33,46 ---- int s_wxluatag_wxLuaState = -1; static int LUACALL wxLua_wxLuaState_Delete(lua_State *L) { wxLuaState wxlState(L); wxLuaState * self = (wxLuaState *)wxlState.GetUserDataType(1, s_wxluatag_wxLuaState); ! // 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; } *************** *** 62,66 **** // Map Lua Class Methods to C Binding Functions WXLUAMETHOD wxLuaState_methods[] = { - { LuaDelete, "wxLuaState", wxLua_wxLuaState_destructor, 0, 0, s_wxluaargArray_None }, { LuaMethod, "Delete", wxLua_wxLuaState_Delete, 0, 0, s_wxluaargArray_None }, }; --- 50,53 ---- *************** *** 84,88 **** returns = new wxLuaObject(wxlState, 1); // add to tracked memory list ! wxLua_AddTrackedObject(wxlState, returns); // push the constructed class pointer wxlState.PushUserDataType(s_wxluatag_wxLuaObject, returns); --- 71,75 ---- returns = new wxLuaObject(wxlState, 1); // add to tracked memory list ! wxlState.AddTrackedObject(returns); // push the constructed class pointer wxlState.PushUserDataType(s_wxluatag_wxLuaObject, returns); *************** *** 171,196 **** } - static int LUACALL wxLua_wxLuaObject_destructor(lua_State *L) - { - wxLuaState wxlState(L); - wxLuaObject * self = (wxLuaObject *)wxlState.GetUserDataType(1, s_wxluatag_wxLuaObject); - - // remove from tracked memory list - if (self != 0) - wxlState.RemoveTrackedObject(self); - return 0; - } - static int LUACALL wxLua_wxLuaObject_Delete(lua_State *L) { wxLuaState wxlState(L); wxLuaObject * self = (wxLuaObject *)wxlState.GetUserDataType(1, s_wxluatag_wxLuaObject); ! // remove from tracked memory list ! if (self != 0) ! if (wxlState.RemoveTrackedObject(self)) ! { // if removed, reset the tag so that gc() is not called on this object. ! lua_pushnil(L); ! lua_setmetatable(L, -2); ! } return 0; } --- 158,171 ---- } static int LUACALL wxLua_wxLuaObject_Delete(lua_State *L) { wxLuaState wxlState(L); wxLuaObject * self = (wxLuaObject *)wxlState.GetUserDataType(1, s_wxluatag_wxLuaObject); ! // 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; } *************** *** 209,213 **** { LuaGetProp, "Object", wxLua_wxLuaObject_GetObject, 0, 0, s_wxluaargArray_None }, { LuaSetProp, "Object", wxLua_wxLuaObject_SetObject, 1, 1, s_wxluaargArray_None }, - { LuaDelete, "wxLuaObject", wxLua_wxLuaObject_destructor, 0, 0, s_wxluaargArray_None }, { LuaMethod, "Delete", wxLua_wxLuaObject_Delete, 0, 0, s_wxluaargArray_None }, }; --- 184,187 ---- *************** *** 240,244 **** returns = new wxLuaPrintout(wxlState, title, pObject); // add to tracked memory list ! wxLua_AddTrackedObject(wxlState, (wxLuaPrintout *)returns); // push the constructed class pointer wxlState.PushUserDataType(s_wxluatag_wxLuaPrintout, returns); --- 214,218 ---- returns = new wxLuaPrintout(wxlState, title, pObject); // add to tracked memory list ! wxlState.AddTrackedObject((wxLuaPrintout *)returns); // push the constructed class pointer wxlState.PushUserDataType(s_wxluatag_wxLuaPrintout, returns); *************** *** 285,310 **** } - static int LUACALL wxLua_wxLuaPrintout_destructor(lua_State *L) - { - wxLuaState wxlState(L); - wxLuaPrintout * self = (wxLuaPrintout *)wxlState.GetUserDataType(1, s_wxluatag_wxLuaPrintout); - - // remove from tracked memory list - if (self != 0) - wxlState.RemoveTrackedObject(self); - return 0; - } - static int LUACALL wxLua_wxLuaPrintout_Delete(lua_State *L) { wxLuaState wxlState(L); wxLuaPrintout * self = (wxLuaPrintout *)wxlState.GetUserDataType(1, s_wxluatag_wxLuaPrintout); ! // remove from tracked memory list ! if (self != 0) ! if (wxlState.RemoveTrackedObject(self)) ! { // if removed, reset the tag so that gc() is not called on this object. ! lua_pushnil(L); ! lua_setmetatable(L, -2); ! } return 0; } --- 259,272 ---- } static int LUACALL wxLua_wxLuaPrintout_Delete(lua_State *L) { wxLuaState wxlState(L); wxLuaPrintout * self = (wxLuaPrintout *)wxlState.GetUserDataType(1, s_wxluatag_wxLuaPrintout); ! // 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; } *************** *** 317,321 **** { LuaMethod, "GetID", wxLua_wxLuaPrintout_GetID, 0, 0, s_wxluaargArray_None }, { LuaMethod, "SetPageInfo", wxLua_wxLuaPrintout_SetPageInfo, 4, 2, s_wxluatagArray_wxLua_wxLuaPrintout_SetPageInfo }, - { LuaDelete, "wxLuaPrintout", wxLua_wxLuaPrintout_destructor, 0, 0, s_wxluaargArray_None }, { LuaMethod, "Delete", wxLua_wxLuaPrintout_Delete, 0, 0, s_wxluaargArray_None }, }; --- 279,282 ---- *************** *** 369,377 **** #endif // (wxLUA_USE_wxLuaHtmlWindow) && (wxLUA_USE_wxPointSizeRect) - static int LUACALL wxLua_wxLuaHtmlWindow_destructor(lua_State *) - { - return 0; - } - --- 330,333 ---- *************** *** 383,387 **** #endif // (wxLUA_USE_wxLuaHtmlWindow) && (wxLUA_USE_wxPointSizeRect) - { LuaDelete, "wxLuaHtmlWindow", wxLua_wxLuaHtmlWindow_destructor, 0, 0, s_wxluaargArray_None }, }; --- 339,342 ---- *************** *** 464,489 **** } - static int LUACALL wxLua_wxLuaHtmlWinTagEvent_destructor(lua_State *L) - { - wxLuaState wxlState(L); - wxLuaHtmlWinTagEvent * self = (wxLuaHtmlWinTagEvent *)wxlState.GetUserDataType(1, s_wxluatag_wxLuaHtmlWinTagEvent); - - // remove from tracked memory list - if (self != 0) - wxlState.RemoveTrackedObject(self); - return 0; - } - static int LUACALL wxLua_wxLuaHtmlWinTagEvent_Delete(lua_State *L) { wxLuaState wxlState(L); wxLuaHtmlWinTagEvent * self = (wxLuaHtmlWinTagEvent *)wxlState.GetUserDataType(1, s_wxluatag_wxLuaHtmlWinTagEvent); ! // remove from tracked memory list ! if (self != 0) ! if (wxlState.RemoveTrackedObject(self)) ! { // if removed, reset the tag so that gc() is not called on this object. ! lua_pushnil(L); ! lua_setmetatable(L, -2); ! } return 0; } --- 419,432 ---- } static int LUACALL wxLua_wxLuaHtmlWinTagEvent_Delete(lua_State *L) { wxLuaState wxlState(L); wxLuaHtmlWinTagEvent * self = (wxLuaHtmlWinTagEvent *)wxlState.GetUserDataType(1, s_wxluatag_wxLuaHtmlWinTagEvent); ! // 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; } *************** *** 505,509 **** { LuaGetProp, "ParseInnerCalled", wxLua_wxLuaHtmlWinTagEvent_GetParseInnerCalled, 0, 0, s_wxluaargArray_None }, { LuaSetProp, "ParseInnerCalled", wxLua_wxLuaHtmlWinTagEvent_SetParseInnerCalled, 1, 1, s_wxluaargArray_None }, - { LuaDelete, "wxLuaHtmlWinTagEvent", wxLua_wxLuaHtmlWinTagEvent_destructor, 0, 0, s_wxluaargArray_None }, { LuaMethod, "Delete", wxLua_wxLuaHtmlWinTagEvent_Delete, 0, 0, s_wxluaargArray_None }, }; --- 448,451 ---- *************** *** 569,577 **** } - static int LUACALL wxLua_wxLuaTreeItemData_destructor(lua_State *) - { - return 0; - } - --- 511,514 ---- *************** *** 583,587 **** { LuaGetProp, "Value", wxLua_wxLuaTreeItemData_GetValue, 0, 0, s_wxluaargArray_None }, { LuaSetProp, "Value", wxLua_wxLuaTreeItemData_SetValue, 1, 1, s_wxluaargArray_None }, - { LuaDelete, "wxLuaTreeItemData", wxLua_wxLuaTreeItemData_destructor, 0, 0, s_wxluaargArray_None }, }; --- 520,523 ---- Index: image.cpp =================================================================== RCS file: /cvsroot/wxlua/wxLua/modules/wxbind/src/image.cpp,v retrieving revision 1.31 retrieving revision 1.32 diff -C2 -d -r1.31 -r1.32 *** image.cpp 13 Mar 2007 23:01:57 -0000 1.31 --- image.cpp 15 Mar 2007 00:01:19 -0000 1.32 *************** *** 51,55 **** returns = new wxImage(self->Blur(radius)); // add the new object to the tracked memory list ! wxLua_AddTrackedObject(wxlState, (wxImage *)returns); // push the result datatype wxlState.PushUserDataType(s_wxluatag_wxImage, returns); --- 51,55 ---- returns = new wxImage(self->Blur(radius)); // add the new object to the tracked memory list ! wxlState.AddTrackedObject((wxImage *)returns); // push the result datatype wxlState.PushUserDataType(s_wxluatag_wxImage, returns); *************** *** 72,76 **** returns = new wxImage(self->BlurHorizontal(radius)); // add the new object to the tracked memory list ! wxLua_AddTrackedObject(wxlState, (wxImage *)returns); // push the result datatype wxlState.PushUserDataType(s_wxluatag_wxImage, returns); --- 72,76 ---- returns = new wxImage(self->BlurHorizontal(radius)); // add the new object to the tracked memory list ! wxlState.AddTrackedObject((wxImage *)returns); // push the result datatype wxlState.PushUserDataType(s_wxluatag_wxImage, returns); *************** *** 93,97 **** returns = new wxImage(self->BlurVertical(radius)); // add the new object to the tracked memory list ! wxLua_AddTrackedObject(wxlState, (wxImage *)returns); // push the result datatype wxlState.PushUserDataType(s_wxluatag_wxImage, returns); --- 93,97 ---- returns = new wxImage(self->BlurVertical(radius)); // add the new object to the tracked memory list ! wxlState.AddTrackedObject((wxImage *)returns); // push the result datatype wxlState.PushUserDataType(s_wxluatag_wxImage, returns); *************** *** 120,124 **** returns = new wxImage(self->ConvertToGreyscale(lr, lg, lb)); // add the new object to the tracked memory list ! wxLua_AddTrackedObject(wxlState, (wxImage *)returns); // push the result datatype wxlState.PushUserDataType(s_wxluatag_wxImage, returns); --- 120,124 ---- returns = new wxImage(self->ConvertToGreyscale(lr, lg, lb)); // add the new object to the tracked memory list ! wxlState.AddTrackedObject((wxImage *)returns); // push the result datatype wxlState.PushUserDataType(s_wxluatag_wxImage, returns); *************** *** 143,147 **** returns = new wxImage(self->ResampleBox(width, height)); // add the new object to the tracked memory list ! wxLua_AddTrackedObject(wxlState, (wxImage *)returns); // push the result datatype wxlState.PushUserDataType(s_wxluatag_wxImage, returns); --- 143,147 ---- returns = new wxImage(self->ResampleBox(width, height)); // add the new object to the tracked memory list ! wxlState.AddTrackedObject((wxImage *)returns); // push the result datatype wxlState.PushUserDataType(s_wxluatag_wxImage, returns); *************** *** 166,170 **** returns = new wxImage(self->ResampleBicubic(width, height)); // add the new object to the tracked memory list ! wxLua_AddTrackedObject(wxlState, (wxImage *)returns); // push the result datatype wxlState.PushUserDataType(s_wxluatag_wxImage, returns); --- 166,170 ---- returns = new wxImage(self->ResampleBicubic(width, height)); // add the new object to the tracked memory list ! wxlState.AddTrackedObject((wxImage *)returns); // push the result datatype wxlState.PushUserDataType(s_wxluatag_wxImage, returns); *************** *** 217,221 **** returns = new wxImage(self->Scale(width, height, quality)); // add the new object to the tracked memory list ! wxLua_AddTrackedObject(wxlState, (wxImage *)returns); // push the result datatype wxlState.PushUserDataType(s_wxluatag_wxImage, returns); --- 217,221 ---- returns = new wxImage(self->Scale(width, height, quality)); // add the new object to the tracked memory list ! wxlState.AddTrackedObject((wxImage *)returns); // push the result datatype wxlState.PushUserDataType(s_wxluatag_wxImage, returns); *************** *** 240,244 **** returns = new wxImage(bitmap->ConvertToImage()); // add to tracked memory list ! wxLua_AddTrackedObject(wxlState, returns); // push the constructed class pointer wxlState.PushUserDataType(s_wxluatag_wxImage, returns); --- 240,244 ---- returns = new wxImage(bitmap->ConvertToImage()); // add to tracked memory list ! wxlState.AddTrackedObject(returns); // push the constructed class pointer wxlState.PushUserDataType(s_wxluatag_wxImage, returns); *************** *** 287,291 **** returns = new wxImage(self->Scale(width, height)); // add the new object to the tracked memory list ! wxLua_AddTrackedObject(wxlState, (wxImage *)returns); // push the result datatype wxlState.PushUserDataType(s_wxluatag_wxImage, returns); --- 287,291 ---- returns = new wxImage(self->Scale(width, height)); // add the new object to the tracked memory list ! wxlState.AddTrackedObject((wxImage *)returns); // push the result datatype wxlState.PushUserDataType(s_wxluatag_wxImage, returns); *************** *** 326,330 **** returns = new wxPalette(self->GetPalette()); // add the new object to the tracked memory list ! wxLua_AddTrackedObject(wxlState, (wxPalette *)returns); // push the result datatype wxlState.PushUserDataType(s_wxluatag_wxPalette, returns); --- 326,330 ---- returns = new wxPalette(self->GetPalette()); // add the new object to the tracked memory list ! wxlState.AddTrackedObject((wxPalette *)returns); // push the result datatype wxlState.PushUserDataType(s_wxluatag_wxPalette, returns); *************** *** 366,370 **** returns = new wxImage(self->GetSubImage(*rect)); // add the new object to the tracked memory list ! wxLua_AddTrackedObject(wxlState, (wxImage *)returns); // push the result datatype wxlState.PushUserDataType(s_wxluatag_wxImage, returns); --- 366,370 ---- returns = new wxImage(self->GetSubImage(*rect)); // add the new object to the tracked memory list ! wxlState.AddTrackedObject((wxImage *)returns); // push the result datatype wxlState.PushUserDataType(s_wxluatag_wxImage, returns); *************** *** 423,427 **** returns = new wxImage(self->Rotate(angle, *rotationCentre, interpolating, offsetAfterRotation)); // add the new object to the tracked memory list ! wxLua_AddTrackedObject(wxlState, (wxImage *)returns); // push the result datatype wxlState.PushUserDataType(s_wxluatag_wxImage, returns); --- 423,427 ---- returns = new wxImage(self->Rotate(angle, *rotationCentre, interpolating, offsetAfterRotation)); // add the new object to the tracked memory list ! wxlState.AddTrackedObject((wxImage *)returns); // push the result datatype wxlState.PushUserDataType(s_wxluatag_wxImage, returns); *************** *** 454,458 **** returns = new wxImage(self->Size(*size, *pos, red, green, blue)); // add the new object to the tracked memory list ! wxLua_AddTrackedObject(wxlState, (wxImage *)returns); // push the result datatype wxlState.PushUserDataType(s_wxluatag_wxImage, returns); --- 454,458 ---- returns = new wxImage(self->Size(*size, *pos, red, green, blue)); // add the new object to the tracked memory list ! wxlState.AddTrackedObject((wxImage *)returns); // push the result datatype wxlState.PushUserDataType(s_wxluatag_wxImage, returns); *************** *** 543,547 **** returns = new wxImage(*image); // add to tracked memory list ! wxLua_AddTrackedObject(wxlState, (wxImage *)returns); // push the constructed class pointer wxlState.PushUserDataType(s_wxluatag_wxImage, returns); --- 543,547 ---- returns = new wxImage(*image); // add to tracked memory list ! wxlState.AddTrackedObject((wxImage *)returns); // push the constructed class pointer wxlState.PushUserDataType(s_wxluatag_wxImage, returns); *************** *** 558,562 **** returns = new wxImage(); // add to tracked memory list ! wxLua_AddTrackedObject(wxlState, (wxImage *)returns); // push the constructed class pointer wxlState.PushUserDataType(s_wxluatag_wxImage, returns); --- 558,562 ---- returns = new wxImage(); // add to tracked memory list ! wxlState.AddTrackedObject((wxImage *)returns); // push the constructed class pointer wxlState.PushUserDataType(s_wxluatag_wxImage, returns); *************** *** 582,586 **** returns = new wxImage(width, height, clear); // add to tracked memory list ! wxLua_AddTrackedObject(wxlState, (wxImage *)returns); // push the constructed class pointer wxlState.PushUserDataType(s_wxluatag_wxImage, returns); --- 582,586 ---- returns = new wxImage(width, height, clear); // add to tracked memory list ! wxlState.AddTrackedObject((wxImage *)returns); // push the constructed class pointer wxlState.PushUserDataType(s_wxluatag_wxImage, returns); *************** *** 609,613 **** returns = new wxImage(width, height, data, static_data); // add to tracked memory list ! wxLua_AddTrackedObject(wxlState, returns); // push the constructed class pointer wxlState.PushUserDataType(s_wxluatag_wxImage, returns); --- 609,613 ---- returns = new wxImage(width, height, data, static_data); // add to tracked memory list ! wxlState.AddTrackedObject(returns); // push the constructed class pointer wxlState.PushUserDataType(s_wxluatag_wxImage, returns); *************** *** 631,635 **** returns = new wxImage(name, type); // add to tracked memory list ! wxLua_AddTrackedObject(wxlState, (wxImage *)returns); // push the constructed class pointer wxlState.PushUserDataType(s_wxluatag_wxImage, returns); --- 631,635 ---- returns = new wxImage(name, type); // add to tracked memory list ! wxlState.AddTrackedObject((wxImage *)returns); // push the constructed class pointer wxlState.PushUserDataType(s_wxluatag_wxImage, returns); *************** *** 697,701 **** returns = new wxImage(self->ConvertToMono(r, g, b)); // add the new object to the tracked memory list ! wxLua_AddTrackedObject(wxlState, (wxImage *)returns); // push the result datatype wxlState.PushUserDataType(s_wxluatag_wxImage, returns); --- 697,701 ---- returns = new wxImage(self->ConvertToMono(r, g, b)); // add the new object to the tracked memory list ! wxlState.AddTrackedObject((wxImage *)returns); // push the result datatype wxlState.PushUserDataType(s_wxluatag_wxImage, returns); *************** *** 715,719 **** returns = new wxImage(self->Copy()); // add the new object to the tracked memory list ! wxLua_AddTrackedObject(wxlState, (wxImage *)returns); // push the result datatype wxlState.PushUserDataType(s_wxluatag_wxImage, returns); --- 715,719 ---- returns = new wxImage(self->Copy()); // add the new object to the tracked memory list ! wxlState.AddTrackedObject((wxImage *)returns); // push the result datatype wxlState.PushUserDataType(s_wxluatag_wxImage, returns); *************** *** 1339,1343 **** returns = new wxImage(self->Mirror(horizontally)); // add the new object to the tracked memory list ! wxLua_AddTrackedObject(wxlState, (wxImage *)returns); // push the result datatype wxlState.PushUserDataType(s_wxluatag_wxImage, returns); --- 1339,1343 ---- returns = new wxImage(self->Mirror(horizontally)); // add the new object to the tracked memory list ! wxlState.AddTrackedObject((wxImage *)returns); // push the result datatype wxlState.PushUserDataType(s_wxluatag_wxImage, returns); *************** *** 1402,1406 **** returns = new wxImage(self->Rotate90(clockwise)); // add the new object to the tracked memory list ! wxLua_AddTrackedObject(wxlState, (wxImage *)returns); // push the result datatype wxlState.PushUserDataType(s_wxluatag_wxImage, returns); --- 1402,1406 ---- returns = new wxImage(self->Rotate90(clockwise)); // add the new object to the tracked memory list ! wxlState.AddTrackedObject((wxImage *)returns); // push the result datatype wxlState.PushUserDataType(s_wxluatag_wxImage, returns); *************** *** 1663,1688 **** } - static int LUACALL wxLua_wxImage_destructor(lua_State *L) - { - wxLuaState wxlState(L); - wxImage * self = (wxImage *)wxlState.GetUserDataType(1, s_wxluatag_wxImage); - - // remove from tracked memory list - if (self != 0) - wxlState.RemoveTrackedObject(self); - return 0; - } - static int LUACALL wxLua_wxImage_Delete(lua_State *L) { wxLuaState wxlState(L); wxImage * self = (wxImage *)wxlState.GetUserDataType(1, s_wxluatag_wxImage); ! // remove from tracked memory list ! if (self != 0) ! if (wxlState.RemoveTrackedObject(self)) ! { // if removed, reset the tag so that gc() is not called on this object. ! lua_pushnil(L); ! lua_setmetatable(L, -2); ! } return 0; } --- 1663,1676 ---- } static int LUACALL wxLua_wxImage_Delete(lua_State *L) { wxLuaState wxlState(L); wxImage * self = (wxImage *)wxlState.GetUserDataType(1, s_wxluatag_wxImage); ! // 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; } *************** *** 1802,1806 **** { LuaMethod, "SetRGB", wxLua_wxImage_SetRGB, 5, 5, s_wxluatagArray_wxLua_wxImage_SetRGB }, { LuaMethod, "op_assign", wxLua_wxImage_op_assign, 1, 1, s_wxluatagArray_wxLua_wxImage_op_assign }, - { LuaDelete, "wxImage", wxLua_wxImage_destructor, 0, 0, s_wxluaargArray_None }, { LuaMethod, "Delete", wxLua_wxImage_Delete, 0, 0, s_wxluaargArray_None }, }; --- 1790,1793 ---- *************** *** 1881,1889 **** } - static int LUACALL wxLua_wxImageHistogramEntry_destructor(lua_State *) - { - return 0; - } - --- 1868,1871 ---- *************** *** 1899,1903 **** { LuaMethod, "SetValue", wxLua_wxImageHistogramEntry_SetValue, 0, 0, s_wxluaargArray_None }, { LuaSetProp, "value", wxLua_wxImageHistogramEntry_SetValue, 0, 0, s_wxluaargArray_None }, - { LuaDelete, "wxImageHistogramEntry", wxLua_wxImageHistogramEntry_destructor, 0, 0, s_wxluaargArray_None }, }; --- 1881,1884 ---- *************** *** 2002,2010 **** } - static int LUACALL wxLua_wxImageHistogram_iterator_destructor(lua_State *) - { - return 0; - } - --- 1983,1986 ---- *************** *** 2021,2025 **** { LuaMethod, "op_eq", wxLua_wxImageHistogram_iterator_op_eq, 1, 1, s_wxluatagArray_wxLua_wxImageHistogram_iterator_op_eq }, { LuaMethod, "op_inc", wxLua_wxImageHistogram_iterator_op_inc, 0, 0, s_wxluaargArray_None }, - { LuaDelete, "wxImageHistogram_iterator", wxLua_wxImageHistogram_iterator_destructor, 0, 0, s_wxluaargArray_None }, }; --- 1997,2000 ---- *************** *** 2080,2084 **** returns = new wxImageHistogram::iterator(self->begin()); // add the new object to the tracked memory list ! wxLua_AddTrackedObject(wxlState, (wxImageHistogram::iterator *)returns); // push the result datatype wxlState.PushUserDataType(s_wxluatag_wxImageHistogram_iterator, returns); --- 2055,2059 ---- returns = new wxImageHistogram::iterator(self->begin()); // add the new object to the tracked memory list ! wxlState.AddTrackedObject((long)returns, new wxObject_wxImageHistogram_iterator((wxImageHistogram::iterator *)returns)); // push the result datatype wxlState.PushUserDataType(s_wxluatag_wxImageHistogram_iterator, returns); *************** *** 2143,2147 **** returns = new wxImageHistogram::iterator(self->end()); // add the new object to the tracked memory list ! wxLua_AddTrackedObject(wxlState, (wxImageHistogram::iterator *)returns); // push the result datatype wxlState.PushUserDataType(s_wxluatag_wxImageHistogram_iterator, returns); --- 2118,2122 ---- returns = new wxImageHistogram::iterator(self->end()); // add the new object to the tracked memory list ! wxlState.AddTrackedObject((long)returns, new wxObject_wxImageHistogram_iterator((wxImageHistogram::iterator *)returns)); // push the result datatype wxlState.PushUserDataType(s_wxluatag_wxImageHistogram_iterator, returns); *************** *** 2182,2186 **** returns = new wxImageHistogram::iterator(self->find(key)); // add the new object to the tracked memory list ! wxLua_AddTrackedObject(wxlState, (wxImageHistogram::iterator *)returns); // push the result datatype wxlState.PushUserDataType(s_wxluatag_wxImageHistogram_iterator, returns); --- 2157,2161 ---- returns = new wxImageHistogram::iterator(self->find(key)); // add the new object to the tracked memory list ! wxlState.AddTrackedObject((long)returns, new wxObject_wxImageHistogram_iterator((wxImageHistogram::iterator *)returns)); // push the result datatype wxlState.PushUserDataType(s_wxluatag_wxImageHistogram_iterator, returns); *************** *** 2204,2212 **** } - static int LUACALL wxLua_wxImageHistogram_destructor(lua_State *) - { - return 0; - } - --- 2179,2182 ---- *************** *** 2223,2227 **** { LuaMethod, "find", wxLua_wxImageHistogram_find, 1, 1, s_wxluatagArray_wxLua_wxImageHistogram_find }, { LuaMethod, "size", wxLua_wxImageHistogram_size, 0, 0, s_wxluaargArray_None }, - { LuaDelete, "wxImageHistogram", wxLua_wxImageHistogram_destructor, 0, 0, s_wxluaargArray_None }, }; --- 2193,2196 ---- *************** *** 2426,2451 **** } - static int LUACALL wxLua_wxImageHandler_destructor(lua_State *L) - { - wxLuaState wxlState(L); - wxImageHandler * self = (wxImageHandler *)wxlState.GetUserDataType(1, s_wxluatag_wxImageHandler); - - // remove from tracked memory list - if (self != 0) - wxlState.RemoveTrackedObject(self); - return 0; - } - static int LUACALL wxLua_wxImageHandler_Delete(lua_State *L) { wxLuaState wxlState(L); wxImageHandler * self = (wxImageHandler *)wxlState.GetUserDataType(1, s_wxluatag_wxImageHandler); ! // remove from tracked memory list ! if (self != 0) ! if (wxlState.RemoveTrackedObject(self)) ! { // if removed, reset the tag so that gc() is not called on this object. ! lua_pushnil(L); ! lua_setmetatable(L, -2); ! } return 0; } --- 2395,2408 ---- } static int LUACALL wxLua_wxImageHandler_Delete(lua_State *L) { wxLuaState wxlState(L); wxImageHandler * self = (wxImageHandler *)wxlState.GetUserDataType(1, s_wxluatag_wxImageHandler); ! // 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; } *************** *** 2478,2482 **** { LuaGetProp, "Type", wxLua_wxImageHandler_GetType, 0, 0, s_wxluaargArray_None }, { LuaSetProp, "Type", wxLua_wxImageHandler_SetType, 1, 1, s_wxluaargArray_None }, - { LuaDelete, "wxImageHandler", wxLua_wxImageHandler_destructor, 0, 0, s_wxluaargArray_None }, { LuaMethod, "Delete", wxLua_wxImageHandler_Delete, 0, 0, s_wxluaargArray_None }, }; --- 2435,2438 ---- *************** *** 2510,2518 **** } - static int LUACALL wxLua_wxBMPHandler_destructor(lua_State *) - { - return 0; - } - --- 2466,2469 ---- *************** *** 2520,2524 **** WXLUAMETHOD wxBMPHandler_methods[] = { { LuaConstructor, "wxBMPHandler", wxLua_wxBMPHandler_constructor, 0, 0, s_wxluaargArray_None }, - { LuaDelete, "wxBMPHandler", wxLua_wxBMPHandler_destructor, 0, 0, s_wxluaargArray_None }, }; --- 2471,2474 ---- *************** *** 2551,2559 **** } - static int LUACALL wxLua_wxICOHandler_destructor(lua_State *) - { - return 0; - } - --- 2501,2504 ---- *************** *** 2561,2565 **** WXLUAMETHOD wxICOHandler_methods[] = { { LuaConstructor, "wxICOHandler", wxLua_wxICOHandler_constructor, 0, 0, s_wxluaargArray_None }, - { LuaDelete, "wxICOHandler", wxLua_wxICOHandler_destructor, 0, 0, s_wxluaargArray_None }, }; --- 2506,2509 ---- *************** *** 2592,2600 **** } - static int LUACALL wxLua_wxCURHandler_destructor(lua_State *) - { - return 0; - } - --- 2536,2539 ---- *************** *** 2602,2606 **** WXLUAMETHOD wxCURHandler_methods[] = { { LuaConstructor, "wxCURHandler", wxLua_wxCURHandler_constructor, 0, 0, s_wxluaargArray_None }, - { LuaDelete, "wxCURHandler", wxLua_wxCURHandler_destructor, 0, 0, s_wxluaargArray_None }, }; --- 2541,2544 ---- *************** *** 2633,2641 **** } - static int LUACALL wxLua_wxANIHandler_destructor(lua_State *) - { - return 0; - } - --- 2571,2574 ---- *************** *** 2643,2647 **** WXLUAMETHOD wxANIHandler_methods[] = { { LuaConstructor, "wxANIHandler", wxLua_wxANIHandler_constructor, 0, 0, s_wxluaargArray_None }, - { LuaDelete, "wxANIHandler", wxLua_wxANIHandler_destructor, 0, 0, s_wxluaargArray_None }, }; --- 2576,2579 ---- *************** *** 2674,2682 **** } - static int LUACALL wxLua_wxIFFHandler_destructor(lua_State *) - { - return 0; - } - --- 2606,2609 ---- *************** *** 2684,2688 **** WXLUAMETHOD wxIFFHandler_methods[] = { { LuaConstructor, "wxIFFHandler", wxLua_wxIFFHandler_constructor, 0, 0, s_wxluaargArray_None }, - { LuaDelete, "wxIFFHandler", wxLua_wxIFFHandler_destructor, 0, 0, s_wxluaargArray_None }, }; --- 2611,2614 ---- *************** *** 2715,2723 **** } - static int LUACALL wxLua_wxGIFHandler_destructor(lua_State *) - { - return 0; - } - --- 2641,2644 ---- *************** *** 2725,2729 **** WXLUAMETHOD wxGIFHandler_methods[] = { { LuaConstructor, "wxGIFHandler", wxLua_wxGIFHandler_constructor, 0, 0, s_wxluaargArray_None }, - { LuaDelete, "wxGIFHandler", wxLua_wxGIFHandler_destructor, 0, 0, s_wxluaargArray_None }, }; --- 2646,2649 ---- *************** *** 2756,2764 **** } - static int LUACALL wxLua_wxJPEGHandler_destructor(lua_State *) - { - return 0; - } - --- 2676,2679 ---- *************** *** 2766,2770 **** WXLUAMETHOD wxJPEGHandler_methods[] = { { LuaConstructor, "wxJPEGHandler", wxLua_wxJPEGHandler_constructor, 0, 0, s_wxluaargArray_None }, - { LuaDelete, "wxJPEGHandler", wxLua_wxJPEGHandler_destructor, 0, 0, s_wxluaargArray_None }, }; --- 2681,2684 ---- *************** *** 2797,2805 **** } - static int LUACALL wxLua_wxPCXHandler_destructor(lua_State *) - { - return 0; - } - --- 2711,2714 ---- *************** *** 2807,2811 **** WXLUAMETHOD wxPCXHandler_methods[] = { { LuaConstructor, "wxPCXHandler", wxLua_wxPCXHandler_constructor, 0, 0, s_wxluaargArray_None }, - { LuaDelete, "wxPCXHandler", wxLua_wxPCXHandler_destructor, 0, 0, s_wxluaargArray_None }, }; --- 2716,2719 ---- *************** *** 2838,2846 **** } - static int LUACALL wxLua_wxPNGHandler_destructor(lua_State *) - { - return 0; - } - --- 2746,2749 ---- *********... [truncated message content] |