From: John L. <jr...@us...> - 2006-12-08 06:16:21
|
Update of /cvsroot/wxlua/wxLua/modules/wxluasocket/src In directory sc8-pr-cvs9.sourceforge.net:/tmp/cvs-serv8247/wxLua/modules/wxluasocket/src Modified Files: wxldserv.cpp wxldtarg.cpp Log Message: subclass the wxProcess in the debugger so we don't have to send an event fixes crashes when an error occurs in the debugger's lua program test compile lua programs before running or debugging to catch syntax errors Index: wxldtarg.cpp =================================================================== RCS file: /cvsroot/wxlua/wxLua/modules/wxluasocket/src/wxldtarg.cpp,v retrieving revision 1.30 retrieving revision 1.31 diff -C2 -d -r1.30 -r1.31 *** wxldtarg.cpp 5 Oct 2006 05:10:47 -0000 1.30 --- wxldtarg.cpp 8 Dec 2006 06:16:17 -0000 1.31 *************** *** 143,147 **** { NotifyError(errorMsg); - m_bufferArray.Clear(); break; } --- 143,146 ---- *************** *** 166,170 **** m_clientSocket.Close(); } ! m_pThread->Wait(); } --- 165,171 ---- m_clientSocket.Close(); } ! ! if (m_pThread) ! m_pThread->Wait(); } Index: wxldserv.cpp =================================================================== RCS file: /cvsroot/wxlua/wxLua/modules/wxluasocket/src/wxldserv.cpp,v retrieving revision 1.31 retrieving revision 1.32 diff -C2 -d -r1.31 -r1.32 *** wxldserv.cpp 1 Dec 2006 23:40:27 -0000 1.31 --- wxldserv.cpp 8 Dec 2006 06:16:17 -0000 1.32 *************** *** 140,143 **** --- 140,163 ---- // ---------------------------------------------------------------------------- + // wxLuaDebuggerProcess + // ---------------------------------------------------------------------------- + + void wxLuaDebuggerProcess::OnTerminate(int pid, int status) + { + // If this is being deleted from the destructor of wxLuaDebuggerBase + // it has already been NULLed so don't send event or delete this. + if (m_debugger->m_debuggeeProcess) + { + // we don't use the event handler, but this is good enough. + wxProcessEvent event(m_id, pid, status); + m_debugger->OnEndDebugeeProcess(event); + + m_debugger->m_debuggeeProcess = NULL; + m_debugger->m_debuggeeProcessID = -1; + delete this; + } + } + + // ---------------------------------------------------------------------------- // wxLuaDebuggerBase // ---------------------------------------------------------------------------- *************** *** 153,157 **** EVT_WXLUA_DEBUGGER_TABLE_ENUM( wxID_ANY, wxLuaDebuggerBase::OnDebugTableEnum) ! EVT_END_PROCESS(ID_WXLUASOCKET_DEBUGGEE_PROCESS, wxLuaDebuggerBase::OnEndDebugeeProcess) END_EVENT_TABLE() --- 173,177 ---- EVT_WXLUA_DEBUGGER_TABLE_ENUM( wxID_ANY, wxLuaDebuggerBase::OnDebugTableEnum) ! //EVT_END_PROCESS(ID_WXLUASOCKET_DEBUGGEE_PROCESS, wxLuaDebuggerBase::OnEndDebugeeProcess) END_EVENT_TABLE() *************** *** 180,188 **** if ((m_debuggeeProcess != NULL) && (m_debuggeeProcessID > 0)) { ! // disconnect our event handler ! if (m_debuggeeProcess->GetNextHandler() == this) ! m_debuggeeProcess->SetNextHandler(NULL); ! ! m_debuggeeProcess->Kill(m_debuggeeProcessID, wxSIGKILL); } } --- 200,208 ---- if ((m_debuggeeProcess != NULL) && (m_debuggeeProcessID > 0)) { ! // NULL the process before deleting so it won't try to delete it again ! wxLuaDebuggerProcess *p = m_debuggeeProcess; ! m_debuggeeProcess = NULL; ! if (p->Exists(m_debuggeeProcessID)) ! p->Kill(m_debuggeeProcessID, wxSIGKILL); } } *************** *** 646,650 **** if ((m_debuggeeProcess == NULL) && !m_fShutdown) { ! m_debuggeeProcess = new wxProcess(this, ID_WXLUASOCKET_DEBUGGEE_PROCESS); wxString command = wxString::Format(wxT("%s -d%s:%u"), GetProgramName().c_str(), --- 666,670 ---- if ((m_debuggeeProcess == NULL) && !m_fShutdown) { ! m_debuggeeProcess = new wxLuaDebuggerProcess(this, ID_WXLUASOCKET_DEBUGGEE_PROCESS); wxString command = wxString::Format(wxT("%s -d%s:%u"), GetProgramName().c_str(), |