Fixed a memory problem

This commit is contained in:
Zane U. Ji 2013-12-20 23:47:50 +08:00
parent 59a82451a7
commit 9d1b206863
1 changed files with 5 additions and 4 deletions

View File

@ -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;
}