X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/05b9332789a3e5c26891df450e5dac358ed31567..2a45803fc3877afd0ae3ce356dfe216505165882:/samples/ipc/baseclient.cpp diff --git a/samples/ipc/baseclient.cpp b/samples/ipc/baseclient.cpp index f10e49b43a..4543148f41 100644 --- a/samples/ipc/baseclient.cpp +++ b/samples/ipc/baseclient.cpp @@ -7,7 +7,7 @@ // Created: 2007-11-08 // RCS-ID: $Id$ // Copyright: (c) 2007 Anders Larsen -// License: wxWindows licence +// Licence: wxWindows licence /////////////////////////////////////////////////////////////////////////////// // ============================================================================ @@ -184,8 +184,7 @@ void MyClient::Disconnect() if (m_connection) { m_connection->Disconnect(); - delete m_connection; - m_connection = NULL; + wxDELETE(m_connection); wxLogMessage("Client disconnected from server"); } wxGetApp().ExitMainLoop(); @@ -229,18 +228,23 @@ void MyClient::Notify() case 15: testfunc = &MyClient::TestDisconnect; + // We don't need the timer any more, we're going to exit soon. + Stop(); break; + + default: + // No need to wake up idle handling. + return; } - if ( testfunc ) - m_tests.push_back(testfunc); + m_tests.push_back(testfunc); wxWakeUpIdle(); } void MyClient::StartNextTestIfNecessary() { - if ( !m_tests.empty() ) + while ( !m_tests.empty() ) { MyClientTestFunc testfunc = m_tests.front(); m_tests.erase(m_tests.begin()); @@ -319,7 +323,9 @@ bool MyConnection::DoExecute(const void *data, size_t size, wxIPCFormat format) Log("Execute", wxEmptyString, wxEmptyString, data, size, format); bool retval = wxConnection::DoExecute(data, size, format); if (!retval) + { wxLogMessage("Execute failed!"); + } return retval; }