From: John L. <jr...@us...> - 2007-03-15 00:01:40
|
Update of /cvsroot/wxlua/wxLua/modules/wxbindstc/src In directory sc8-pr-cvs9.sourceforge.net:/tmp/cvs-serv15657/wxLua/modules/wxbindstc/src Modified Files: stc.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: stc.cpp =================================================================== RCS file: /cvsroot/wxlua/wxLua/modules/wxbindstc/src/stc.cpp,v retrieving revision 1.27 retrieving revision 1.28 diff -C2 -d -r1.27 -r1.28 *** stc.cpp 9 Mar 2007 00:15:18 -0000 1.27 --- stc.cpp 15 Mar 2007 00:01:24 -0000 1.28 *************** *** 40,44 **** returns = new wxColour(self->GetCaretLineBackground()); // add the new object to the tracked memory list ! wxLua_AddTrackedObject(wxlState, (wxColour *)returns); // push the result datatype wxlState.PushUserDataType(s_wxluatag_wxColour, returns); --- 40,44 ---- returns = new wxColour(self->GetCaretLineBackground()); // add the new object to the tracked memory list ! wxlState.AddTrackedObject((wxColour *)returns); // push the result datatype wxlState.PushUserDataType(s_wxluatag_wxColour, returns); *************** *** 77,81 **** returns = new wxColour(self->GetCaretLineBack()); // add the new object to the tracked memory list ! wxLua_AddTrackedObject(wxlState, (wxColour *)returns); // push the result datatype wxlState.PushUserDataType(s_wxluatag_wxColour, returns); --- 77,81 ---- returns = new wxColour(self->GetCaretLineBack()); // add the new object to the tracked memory list ! wxlState.AddTrackedObject((wxColour *)returns); // push the result datatype wxlState.PushUserDataType(s_wxluatag_wxColour, returns); *************** *** 6216,6224 **** } - static int LUACALL wxLua_wxStyledTextCtrl_destructor(lua_State *) - { - return 0; - } - #if wxLUA_USE_wxBitmap --- 6216,6219 ---- *************** *** 6432,6436 **** returns = new wxColour(self->IndicatorGetForeground(indic)); // add the new object to the tracked memory list ! wxLua_AddTrackedObject(wxlState, (wxColour *)returns); // push the result datatype wxlState.PushUserDataType(s_wxluatag_wxColour, returns); --- 6427,6431 ---- returns = new wxColour(self->IndicatorGetForeground(indic)); // add the new object to the tracked memory list ! wxlState.AddTrackedObject((wxColour *)returns); // push the result datatype wxlState.PushUserDataType(s_wxluatag_wxColour, returns); *************** *** 6484,6488 **** returns = new wxColour(self->GetCaretForeground()); // add the new object to the tracked memory list ! wxLua_AddTrackedObject(wxlState, (wxColour *)returns); // push the result datatype wxlState.PushUserDataType(s_wxluatag_wxColour, returns); --- 6479,6483 ---- returns = new wxColour(self->GetCaretForeground()); // add the new object to the tracked memory list ! wxlState.AddTrackedObject((wxColour *)returns); // push the result datatype wxlState.PushUserDataType(s_wxluatag_wxColour, returns); *************** *** 6581,6585 **** returns = new wxColour(self->GetEdgeColour()); // add the new object to the tracked memory list ! wxLua_AddTrackedObject(wxlState, (wxColour *)returns); // push the result datatype wxlState.PushUserDataType(s_wxluatag_wxColour, returns); --- 6576,6580 ---- returns = new wxColour(self->GetEdgeColour()); // add the new object to the tracked memory list ! wxlState.AddTrackedObject((wxColour *)returns); // push the result datatype wxlState.PushUserDataType(s_wxluatag_wxColour, returns); *************** *** 6771,6775 **** returns = new wxPoint(self->PointFromPosition(pos)); // add the new object to the tracked memory list ! wxLua_AddTrackedObject(wxlState, (wxPoint *)returns); // push the result datatype wxlState.PushUserDataType(s_wxluatag_wxPoint, returns); --- 6766,6770 ---- returns = new wxPoint(self->PointFromPosition(pos)); // add the new object to the tracked memory list ! wxlState.AddTrackedObject((long)returns, new wxObject_wxPoint((wxPoint *)returns)); // push the result datatype wxlState.PushUserDataType(s_wxluatag_wxPoint, returns); *************** *** 7355,7359 **** { LuaGetProp, "LastKeydownProcessed", wxLua_wxStyledTextCtrl_GetLastKeydownProcessed, 0, 0, s_wxluaargArray_None }, { LuaSetProp, "LastKeydownProcessed", wxLua_wxStyledTextCtrl_SetLastKeydownProcessed, 1, 1, s_wxluaargArray_None }, - { LuaDelete, "wxStyledTextCtrl", wxLua_wxStyledTextCtrl_destructor, 0, 0, s_wxluaargArray_None }, #if wxLUA_USE_wxBitmap --- 7350,7353 ---- *************** *** 7436,7440 **** returns = new wxStyledTextEvent(commandType, id); // add to tracked memory list ! wxLua_AddTrackedObject(wxlState, (wxStyledTextEvent *)returns); // push the constructed class pointer wxlState.PushUserDataType(s_wxluatag_wxStyledTextEvent, returns); --- 7430,7434 ---- returns = new wxStyledTextEvent(commandType, id); // add to tracked memory list ! wxlState.AddTrackedObject((wxStyledTextEvent *)returns); // push the constructed class pointer wxlState.PushUserDataType(s_wxluatag_wxStyledTextEvent, returns); *************** *** 8058,8083 **** } - static int LUACALL wxLua_wxStyledTextEvent_destructor(lua_State *L) - { - wxLuaState wxlState(L); - wxStyledTextEvent * self = (wxStyledTextEvent *)wxlState.GetUserDataType(1, s_wxluatag_wxStyledTextEvent); - - // remove from tracked memory list - if (self != 0) - wxlState.RemoveTrackedObject(self); - return 0; - } - static int LUACALL wxLua_wxStyledTextEvent_Delete(lua_State *L) { wxLuaState wxlState(L); wxStyledTextEvent * self = (wxStyledTextEvent *)wxlState.GetUserDataType(1, s_wxluatag_wxStyledTextEvent); ! // 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; } --- 8052,8065 ---- } static int LUACALL wxLua_wxStyledTextEvent_Delete(lua_State *L) { wxLuaState wxlState(L); wxStyledTextEvent * self = (wxStyledTextEvent *)wxlState.GetUserDataType(1, s_wxluatag_wxStyledTextEvent); ! // 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; } *************** *** 8204,8208 **** { LuaGetProp, "Control", wxLua_wxStyledTextEvent_GetControl, 0, 0, s_wxluaargArray_None }, { LuaGetProp, "Alt", wxLua_wxStyledTextEvent_GetAlt, 0, 0, s_wxluaargArray_None }, - { LuaDelete, "wxStyledTextEvent", wxLua_wxStyledTextEvent_destructor, 0, 0, s_wxluaargArray_None }, { LuaMethod, "Delete", wxLua_wxStyledTextEvent_Delete, 0, 0, s_wxluaargArray_None }, --- 8186,8189 ---- |