From 975dc6910e8169e8a996b51de6b16f5cd3ed10a4 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Tue, 10 Jan 2012 17:01:13 +0000 Subject: [PATCH] Added wxAbort() which can also be used under Windows CE. Windows CE doesn't have abort() so provide a wrapper which can be used even there (see #13847). git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@70311 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- include/wx/debug.h | 7 +++++++ interface/wx/debug.h | 11 +++++++++++ src/common/appbase.cpp | 9 +++++++++ src/common/log.cpp | 6 +----- 4 files changed, 28 insertions(+), 5 deletions(-) diff --git a/include/wx/debug.h b/include/wx/debug.h index 2ee3f6dbb0..7529d847c4 100644 --- a/include/wx/debug.h +++ b/include/wx/debug.h @@ -299,6 +299,13 @@ extern void WXDLLIMPEXP_BASE wxOnAssert(const char *file, #define wxASSERT_LEVEL_2(cond) #endif +// This is simply a wrapper for the standard abort() which is not available +// under all platforms. +// +// It isn't really debug-related but there doesn't seem to be any better place +// for it, so declare it here and define it in appbase.cpp, together with +// wxTrap(). +extern void WXDLLIMPEXP_BASE wxAbort(); /* wxCHECK macros always check their conditions, setting debug level to 0 only diff --git a/interface/wx/debug.h b/interface/wx/debug.h index 16ea9e3ea6..2c03d20a45 100644 --- a/interface/wx/debug.h +++ b/interface/wx/debug.h @@ -9,6 +9,17 @@ /** @addtogroup group_funcmacro_debug */ //@{ +/** + Exits the program immediately. + + This is a simple wrapper for the standard abort() function which is not + available under all platforms (currently only Windows CE doesn't provide + it). + + @since 2.9.4 + */ +void wxAbort(); + /** @def wxDEBUG_LEVEL diff --git a/src/common/appbase.cpp b/src/common/appbase.cpp index 9ac78f57f6..4b21c7fcd2 100644 --- a/src/common/appbase.cpp +++ b/src/common/appbase.cpp @@ -1006,6 +1006,15 @@ bool wxAssertIsEqual(int x, int y) return x == y; } +void wxAbort() +{ +#ifdef __WXWINCE__ + ExitThread(3); +#else + abort(); +#endif +} + #if wxDEBUG_LEVEL // break into the debugger diff --git a/src/common/log.cpp b/src/common/log.cpp index 7cc809d803..13ea6a0b9c 100644 --- a/src/common/log.cpp +++ b/src/common/log.cpp @@ -355,11 +355,7 @@ wxLog::OnLog(wxLogLevel level, { wxSafeShowMessage(wxS("Fatal Error"), msg); -#ifdef __WXWINCE__ - ExitThread(3); -#else - abort(); -#endif + wxAbort(); } wxLog *logger; -- 2.45.2