Update of /cvsroot/wxlua/wxLua/modules/wxbind/src
In directory sc8-pr-cvs9.sourceforge.net:/tmp/cvs-serv27681/wxLua/modules/wxbind/src
Modified Files:
wxcore_event.cpp
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_event.cpp
===================================================================
RCS file: /cvsroot/wxlua/wxLua/modules/wxbind/src/wxcore_event.cpp,v
retrieving revision 1.11
retrieving revision 1.12
diff -C2 -d -r1.11 -r1.12
*** wxcore_event.cpp 22 Dec 2007 06:07:12 -0000 1.11
--- wxcore_event.cpp 3 Jan 2008 00:05:57 -0000 1.12
***************
*** 73,78 ****
wxWindowID winId = wxID_ANY;
wxWindowID lastId = wxID_ANY;
! wxEventType eventType = 0;
! wxLuaEventCallback *pCallback = NULL;
int nParams = lua_gettop(L);
--- 73,77 ----
wxWindowID winId = wxID_ANY;
wxWindowID lastId = wxID_ANY;
! wxEventType eventType = wxEVT_NULL;
int nParams = lua_gettop(L);
***************
*** 170,174 ****
// Create and connect the callback
! pCallback = new wxLuaEventCallback(wxlState, func_idx, winId, lastId, eventType, evtHandler);
return 0;
--- 169,179 ----
// 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;
***************
*** 191,195 ****
wxWindowID winId = wxID_ANY;
wxWindowID lastId = wxID_ANY;
! wxEventType eventType = 0;
int nParams = lua_gettop(L);
--- 196,200 ----
wxWindowID winId = wxID_ANY;
wxWindowID lastId = wxID_ANY;
! wxEventType eventType = wxEVT_NULL;
int nParams = lua_gettop(L);
***************
*** 261,266 ****
}
! // Try to disconnect from the callback
! bool returns = evtHandler->Disconnect(winId, lastId, eventType, (wxObjectEventFunction)&wxLuaEventCallback::EventHandler);
lua_pushboolean(L, returns);
--- 266,271 ----
}
! // 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);
|