X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/150cb19558c0ef29aa7f76b48a7e332bc743dda7..010d343bb28bbfd7a702a3ac60be30d15e132ba3:/src/common/init.cpp diff --git a/src/common/init.cpp b/src/common/init.cpp index 14d6056929..fe406b7be9 100644 --- a/src/common/init.cpp +++ b/src/common/init.cpp @@ -111,6 +111,15 @@ public: ~wxCleanupOnExit() { wxEntryCleanup(); } }; +// ---------------------------------------------------------------------------- +// private functions +// ---------------------------------------------------------------------------- + +// suppress warnings about unused variables +static inline void Use(void *) { } + +#define WX_SUPPRESS_UNUSED_WARN(x) Use(&x) + // ---------------------------------------------------------------------------- // initialization data // ---------------------------------------------------------------------------- @@ -380,8 +389,10 @@ int wxEntryReal(int& argc, wxChar **argv) // 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; @@ -415,6 +426,11 @@ int wxEntryReal(int& argc, wxChar **argv) // OnFatalException() if necessary #if defined(__WXMSW__) && wxUSE_ON_FATAL_EXCEPTION +#ifdef __WXWINCE__ +// For ExitThread +#include "wx/msw/private.h" +#endif + extern unsigned long wxGlobalSEHandler(); int wxEntry(int& argc, wxChar **argv) @@ -425,10 +441,17 @@ int wxEntry(int& argc, wxChar **argv) } __except ( wxGlobalSEHandler() ) { +#ifdef __WXWINCE__ + ::ExitThread(3); // the same exit code as abort() +#else ::ExitProcess(3); // the same exit code as abort() +#endif +#if !defined(_MSC_VER) || _MSC_VER < 1300 // this code is unreachable but put it here to suppress warnings + // from some compilers return -1; +#endif } }