From 9d1b2068631596500b93f8a44c129ace2973e7a2 Mon Sep 17 00:00:00 2001 From: "Zane U. Ji" Date: Fri, 20 Dec 2013 23:47:50 +0800 Subject: [PATCH] Fixed a memory problem --- src/myipc.cpp | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/myipc.cpp b/src/myipc.cpp index a9f9370..f286be3 100644 --- a/src/myipc.cpp +++ b/src/myipc.cpp @@ -193,20 +193,21 @@ bool MyClient::talkToServer ( int argc, const wxChar * const *argv ) wxString argument; // wxConnectionBase::Poke expects something other than NULL in debug // version -#ifdef __WXDEBUG__ static wxChar whatBuffer[] = _T ( "Data" ); +#ifdef __WXDEBUG__ + const static size_t bufSize = sizeof ( whatBuffer ) - sizeof ( wxChar ); #else - static wxChar whatBuffer[0]; + const static size_t bufSize = 0; #endif if ( argc <= 1 ) { - connection->Poke ( IPC_NO_FILE, whatBuffer ); + connection->Poke ( IPC_NO_FILE, whatBuffer, bufSize ); } else for ( int i = 1; i < argc; i++ ) { argument = argv[i]; argument = PathResolver::run ( argument ); - if ( ! connection->Poke ( argument, whatBuffer ) ) + if ( ! connection->Poke ( argument, whatBuffer, bufSize ) ) break; }