~wxCleanupOnExit() { wxEntryCleanup(); }
};
+// ----------------------------------------------------------------------------
+// private functions
+// ----------------------------------------------------------------------------
+
+// suppress warnings about unused variables
+static inline void Use(void *) { }
+
+#define WX_SUPPRESS_UNUSED_WARN(x) Use(&x)
+
// ----------------------------------------------------------------------------
// initialization data
// ----------------------------------------------------------------------------
// 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;
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;
}
}
// below returns or throws
wxCleanupOnExit cleanupOnExit;
+ WX_SUPPRESS_UNUSED_WARN(cleanupOnExit);
+
// app initialization
- if ( !wxTheApp->OnInit() )
+ if ( !wxTheApp->CallOnInit() )
{
// don't call OnExit() if OnInit() failed
return -1;
{
::ExitProcess(3); // the same exit code as abort()
+#if !defined(_MSC_VER) || _MSC_VER < 1300
// this code is unreachable but put it here to suppress warnings
+ // from some compilers
return -1;
+#endif
}
}