Update of /cvsroot/wxlua/wxLua/bindings/wxwidgets
In directory sc8-pr-cvs9.sourceforge.net:/tmp/cvs-serv27681/wxLua/bindings/wxwidgets
Modified Files:
wxcore_override.hpp
Log Message:
Change wxLuaEventCallback so it doesn't connect in the constructor to allow
deleting it if it fails before calling lua_error() and it's long jmp.
Renamed the event handler functions to OnEvent() to match the wxWidgets semantics.
Index: wxcore_override.hpp
===================================================================
RCS file: /cvsroot/wxlua/wxLua/bindings/wxwidgets/wxcore_override.hpp,v
retrieving revision 1.15
retrieving revision 1.16
diff -C2 -d -r1.15 -r1.16
*** wxcore_override.hpp 22 Dec 2007 06:07:08 -0000 1.15
--- wxcore_override.hpp 3 Jan 2008 00:05:56 -0000 1.16
***************
*** 1076,1081 ****
wxWindowID winId = wxID_ANY;
wxWindowID lastId = wxID_ANY;
! wxEventType eventType = 0;
! wxLuaEventCallback *pCallback = NULL;
int nParams = lua_gettop(L);
--- 1076,1080 ----
wxWindowID winId = wxID_ANY;
wxWindowID lastId = wxID_ANY;
! wxEventType eventType = wxEVT_NULL;
int nParams = lua_gettop(L);
***************
*** 1173,1177 ****
// Create and connect the callback
! pCallback = new wxLuaEventCallback(wxlState, func_idx, winId, lastId, eventType, evtHandler);
return 0;
--- 1172,1182 ----
// Create and connect the callback
! wxLuaEventCallback* pCallback = new wxLuaEventCallback;
! wxString errMsg(pCallback->Connect(wxlState, func_idx, winId, lastId, eventType, evtHandler));
! if (!errMsg.IsEmpty())
! {
! delete pCallback;
! wxlua_error(L, errMsg);
! }
return 0;
***************
*** 1191,1195 ****
wxWindowID winId = wxID_ANY;
wxWindowID lastId = wxID_ANY;
! wxEventType eventType = 0;
int nParams = lua_gettop(L);
--- 1196,1200 ----
wxWindowID winId = wxID_ANY;
wxWindowID lastId = wxID_ANY;
! wxEventType eventType = wxEVT_NULL;
int nParams = lua_gettop(L);
***************
*** 1261,1266 ****
}
! // Try to disconnect from the callback
! bool returns = evtHandler->Disconnect(winId, lastId, eventType, (wxObjectEventFunction)&wxLuaEventCallback::EventHandler);
lua_pushboolean(L, returns);
--- 1266,1271 ----
}
! // Try to disconnect from the callback, it will delete the wxLuaEventCallback.
! bool returns = evtHandler->Disconnect(winId, lastId, eventType, (wxObjectEventFunction)&wxLuaEventCallback::OnAllEvents);
lua_pushboolean(L, returns);
|