From 150cb19558c0ef29aa7f76b48a7e332bc743dda7 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Tue, 1 Jul 2003 00:29:47 +0000 Subject: [PATCH] fixed Unicode compilation and run-time problems git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@21542 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- src/common/init.cpp | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/src/common/init.cpp b/src/common/init.cpp index 69dadc09e0..14d6056929 100644 --- a/src/common/init.cpp +++ b/src/common/init.cpp @@ -141,7 +141,7 @@ static struct InitData // them to Unicode ourselves (this is the case under Unix but not Windows, // for example), we remember the converted argv here because we'll have to // free it when doing cleanup to avoid memory leaks - wchar_t *argv; + wchar_t **argv; #endif // wxUSE_UNICODE } gs_initData; @@ -168,9 +168,15 @@ static void ConvertArgsToUnicode(int argc, char **argv) static void FreeConvertedArgs() { - for ( int mb_argc = 0; mb_argc < wxTheApp->argc; mb_argc++ ) + if ( gs_initData.argv ) { - free(wxTheApp->argv[mb_argc]); + for ( int i = 0; i < gs_initData.argc; i++ ) + { + free(gs_initData.argv[i]); + } + + delete [] gs_initData.argv; + gs_initData.argv = NULL; } } -- 2.47.2