From: Vadim Zeitlin Date: Fri, 12 Sep 2008 01:36:09 +0000 (+0000) Subject: fix crash under MSW due to constructing a static wxDDEClient instance (this arguably... X-Git-Url: https://git.saurik.com/wxWidgets.git/commitdiff_plain/76a10a0dace367c77b440567be89a66ceb846f7d fix crash under MSW due to constructing a static wxDDEClient instance (this arguably should work but currently doesn't because of use of (yet uninitialized) wxDDEClientObjects in wxDDEClient ctor) git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@55565 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- diff --git a/tests/net/ipc.cpp b/tests/net/ipc.cpp index 735cbcf58f..350eac1368 100644 --- a/tests/net/ipc.cpp +++ b/tests/net/ipc.cpp @@ -183,7 +183,7 @@ private: DECLARE_NO_COPY_CLASS(IPCTestClient) }; -static IPCTestClient gs_client; +static IPCTestClient *gs_client = NULL; // ---------------------------------------------------------------------------- // the test code itself @@ -214,21 +214,22 @@ CPPUNIT_TEST_SUITE_NAMED_REGISTRATION( IPCTestCase, "IPCTestCase" ); void IPCTestCase::Connect() { gs_server = new IPCTestServer; + gs_client = new IPCTestClient; // connecting to the wrong port should fail - CPPUNIT_ASSERT( !gs_client.Connect("localhost", "2424", IPC_TEST_TOPIC) ); + CPPUNIT_ASSERT( !gs_client->Connect("localhost", "2424", IPC_TEST_TOPIC) ); // connecting using an unsupported topic should fail (unless the server // expects a ROT-13'd topic name...) - CPPUNIT_ASSERT( !gs_client.Connect("localhost", IPC_TEST_PORT, "VCP GRFG") ); + CPPUNIT_ASSERT( !gs_client->Connect("localhost", IPC_TEST_PORT, "VCP GRFG") ); // connecting to the right port on the right topic should succeed - CPPUNIT_ASSERT( gs_client.Connect("localhost", IPC_TEST_PORT, IPC_TEST_TOPIC) ); + CPPUNIT_ASSERT( gs_client->Connect("localhost", IPC_TEST_PORT, IPC_TEST_TOPIC) ); } void IPCTestCase::Execute() { - wxConnectionBase& conn = gs_client.GetConn(); + wxConnectionBase& conn = gs_client->GetConn(); const wxString s("Date"); CPPUNIT_ASSERT( conn.Execute(s) ); @@ -240,7 +241,12 @@ void IPCTestCase::Execute() void IPCTestCase::Disconnect() { - gs_client.Disconnect(); + if ( gs_client ) + { + gs_client->Disconnect(); + delete gs_client; + gs_client = NULL; + } if ( gs_server ) {