]> git.saurik.com Git - wxWidgets.git/blobdiff - samples/ipc/baseclient.cpp
Change version to 3.0.0.
[wxWidgets.git] / samples / ipc / baseclient.cpp
index e19e8e274fb83773b9539c7b995212e3621801fd..99ba992876dc938c09cb140a927e5940b92ceac3 100644 (file)
@@ -5,9 +5,8 @@
 //              Most of the code was stolen from: samples/ipc/client.cpp
 //              (c) Julian Smart, Jurgen Doornik
 // Created:     2007-11-08
 //              Most of the code was stolen from: samples/ipc/client.cpp
 //              (c) Julian Smart, Jurgen Doornik
 // Created:     2007-11-08
-// RCS-ID:      $Id$
 // Copyright:   (c) 2007 Anders Larsen
 // Copyright:   (c) 2007 Anders Larsen
-// License:     wxWindows licence
+// Licence:     wxWindows licence
 ///////////////////////////////////////////////////////////////////////////////
 
 // ============================================================================
 ///////////////////////////////////////////////////////////////////////////////
 
 // ============================================================================
@@ -184,8 +183,7 @@ void MyClient::Disconnect()
     if (m_connection)
     {
         m_connection->Disconnect();
     if (m_connection)
     {
         m_connection->Disconnect();
-        delete m_connection;
-        m_connection = NULL;
+        wxDELETE(m_connection);
         wxLogMessage("Client disconnected from server");
     }
     wxGetApp().ExitMainLoop();
         wxLogMessage("Client disconnected from server");
     }
     wxGetApp().ExitMainLoop();
@@ -229,18 +227,23 @@ void MyClient::Notify()
 
         case 15:
             testfunc = &MyClient::TestDisconnect;
 
         case 15:
             testfunc = &MyClient::TestDisconnect;
+            // We don't need the timer any more, we're going to exit soon.
+            Stop();
             break;
             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()
 {
 
     wxWakeUpIdle();
 }
 
 void MyClient::StartNextTestIfNecessary()
 {
-    if ( !m_tests.empty() )
+    while ( !m_tests.empty() )
     {
         MyClientTestFunc testfunc = m_tests.front();
         m_tests.erase(m_tests.begin());
     {
         MyClientTestFunc testfunc = m_tests.front();
         m_tests.erase(m_tests.begin());