X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/1c10eaf7d6998c752e9a98dd8721d2f87e3c03f5..a62489828e83c6196b7f6d4e95d74621d9a7e151:/src/msw/app.cpp diff --git a/src/msw/app.cpp b/src/msw/app.cpp index 591578c2b8..418073ea9f 100644 --- a/src/msw/app.cpp +++ b/src/msw/app.cpp @@ -61,11 +61,9 @@ // Also, OLE is used not just for drag and drop (it's used by automatn.cpp). // #if wxUSE_DRAG_AND_DROP #if !defined(__GNUWIN32__) && !defined(__SC__) && !defined(__SALFORDC__) -#include + #include #endif -// #endif - #include #include @@ -73,31 +71,7 @@ #include #endif -// use debug CRT functions for memory leak detections in VC++ if we're not -// using wxWindows own methods -#if defined(__WXDEBUG__) && defined(_MSC_VER) && !wxUSE_GLOBAL_MEMORY_OPERATORS && !defined(__NO_VC_CRTDBG__) - #define wxUSE_VC_CRTDBG -#else - #undef wxUSE_VC_CRTDBG -#endif - -#ifdef wxUSE_VC_CRTDBG - // VC++ uses this macro as debug/release mode indicator - #ifndef _DEBUG - #define _DEBUG - #endif - - /* Need to undef new if including crtdbg.h */ - #ifdef new - #undef new - #endif - - #include - - #if defined(__WXDEBUG__) && wxUSE_GLOBAL_MEMORY_OPERATORS && wxUSE_DEBUG_NEW_ALWAYS - #define new new(__FILE__,__LINE__) - #endif -#endif // wxUSE_VC_CRTDBG +#include "wx/msw/msvcrt.h" extern char *wxBuffer; extern char *wxOsVersion; @@ -163,13 +137,6 @@ bool wxApp::Initialize() wxBuffer = new char[1500]; -#ifdef wxUSE_VC_CRTDBG - // do check for memory leaks on program exit - // (another useful flag is _CRTDBG_DELAY_FREE_MEM_DF which doesn't free - // deallocated memory which may be used to simulate low-memory condition) - _CrtSetDbgFlag(_CrtSetDbgFlag(_CRTDBG_REPORT_FLAG) | _CRTDBG_LEAK_CHECK_DF); -#endif // debug build under MS VC++ - wxClassInfo::InitializeClasses(); #if wxUSE_RESOURCES @@ -258,8 +225,8 @@ bool wxApp::Initialize() wxWinHandleList = new wxList(wxKEY_INTEGER); - // This is to foil optimizations in Visual C++ that - // throw out dummy.obj. + // This is to foil optimizations in Visual C++ that throw out dummy.obj. + // PLEASE DO NOT ALTER THIS. #if defined(_MSC_VER) && !defined(WXMAKINGDLL) extern char wxDummyChar; if (wxDummyChar) wxDummyChar++; @@ -589,11 +556,16 @@ int wxEntry(WXHINSTANCE hInstance, int nCmdShow, bool enterLoop) { + // do check for memory leaks on program exit + // (another useful flag is _CRTDBG_DELAY_FREE_MEM_DF which doesn't free + // deallocated memory which may be used to simulate low-memory condition) + wxCrtSetDbgFlag(_CRTDBG_LEAK_CHECK_DF); + // take everything into a try-except block in release build // FIXME other compilers must support Win32 SEH (structured exception // handling) too, just find the appropriate keyword in their docs! // Please note that it's _not_ the same as C++ exceptions! -#if !defined(__WXDEBUG__) && defined(_MSC_VER) +#if !defined(__WXDEBUG__) && defined(_MSC_VER) && !defined(__MWERKS__) #define CATCH_PROGRAM_EXCEPTIONS __try {