From: Vadim Zeitlin <vadim@wxwidgets.org>
Date: Tue, 30 Dec 2008 15:06:34 +0000 (+0000)
Subject: compilation fix for g++ which doesn't like using wxLogMessage in wxON_BLOCK_SCOPE_EXIT
X-Git-Url: https://git.saurik.com/wxWidgets.git/commitdiff_plain/f98f168e6c91064ad1977cbdbcf41f9036c5fb09?ds=inline

compilation fix for g++ which doesn't like using wxLogMessage in wxON_BLOCK_SCOPE_EXIT

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@57669 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
---

diff --git a/samples/sockets/client.cpp b/samples/sockets/client.cpp
index e0604c063c..f4b3fc79a8 100644
--- a/samples/sockets/client.cpp
+++ b/samples/sockets/client.cpp
@@ -32,7 +32,6 @@
 #include "wx/socket.h"
 #include "wx/url.h"
 #include "wx/sstream.h"
-#include "wx/scopeguard.h"
 #include <memory>
 
 // --------------------------------------------------------------------------
@@ -104,6 +103,24 @@ private:
   DECLARE_EVENT_TABLE()
 };
 
+// simple helper class to log start and end of each test
+class TestLogger
+{
+public:
+    TestLogger(const wxString& name) : m_name(name)
+    {
+        wxLogMessage("=== %s test begins ===", m_name);
+    }
+
+    ~TestLogger()
+    {
+        wxLogMessage("=== %s test ends ===", m_name);
+    }
+
+private:
+    const wxString m_name;
+};
+
 // --------------------------------------------------------------------------
 // constants
 // --------------------------------------------------------------------------
@@ -595,8 +612,7 @@ void MyFrame::OnTestURL(wxCommandEvent& WXUNUSED(event))
     s_urlname = urlname;
 
 
-    wxLogMessage("=== URL test begins ===");
-    wxON_BLOCK_EXIT1( wxLogMessage, "=== URL test ends ===" );
+    TestLogger logtest("URL");
 
     // Parse the URL
     wxURL url(urlname);