]> git.saurik.com Git - wxWidgets.git/blobdiff - samples/ipc/client.cpp
Don't crash when creating wxStaticBox in wxGTK.
[wxWidgets.git] / samples / ipc / client.cpp
index 36c9d4552d0cfe98936dd131b2513e5c01557e50..a91f524d7d3e93d2a248a388a1355cff34e015b8 100644 (file)
 // we're using TCP/IP or real DDE.
 #include "ipcsetup.h"
 
-#if defined(__WXGTK__) || defined(__WXX11__) || defined(__WXMOTIF__) || defined(__WXMAC__)
-#include "mondrian.xpm"
-#endif
-
 #include "wx/datetime.h"
 #include "client.h"
 
+#ifndef wxHAS_IMAGES_IN_RESOURCES
+    #include "../sample.xpm"
+#endif
+
 // ----------------------------------------------------------------------------
 // wxWin macros
 // ----------------------------------------------------------------------------
@@ -97,7 +97,7 @@ MyFrame::MyFrame(wxFrame *frame, const wxString& title)
         : wxFrame(frame, wxID_ANY, title, wxDefaultPosition, wxSize(400, 300))
 {
     // Give it an icon
-    SetIcon(wxICON(mondrian));
+    SetIcon(wxICON(sample));
 
     // Make a menubar
     wxMenu *file_menu = new wxMenu;
@@ -232,11 +232,8 @@ void MyFrame::EnableControls()
 
 void MyFrame::OnClose(wxCloseEvent& event)
 {
-    if (m_client)
-    {
-        delete m_client;
-        m_client = NULL;
-    }
+    wxDELETE(m_client);
+
     event.Skip();
 }
 
@@ -261,8 +258,7 @@ void MyFrame::OnStart(wxCommandEvent& WXUNUSED(event))
 
     if (!retval)
     {
-        delete m_client;
-        m_client = NULL;
+        wxDELETE(m_client);
     }
     EnableControls();
 }
@@ -316,8 +312,7 @@ void MyFrame::OnDisconnect(wxCommandEvent& WXUNUSED(event))
 
 void MyFrame::Disconnect()
 {
-    delete m_client;
-    m_client = NULL;
+    wxDELETE(m_client);
     EnableControls();
 }
 
@@ -399,8 +394,7 @@ void MyClient::Disconnect()
     if (m_connection)
     {
         m_connection->Disconnect();
-        delete m_connection;
-        m_connection = NULL;
+        wxDELETE(m_connection);
         wxGetApp().GetFrame()->EnableControls();
         wxLogMessage(wxT("Client disconnected from server"));
     }