From 000eea7a2ef45e4053b66bdcc8fd57bfb2e907de Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Mon, 25 Feb 2008 02:51:44 +0000 Subject: [PATCH 1/1] reset s_bInAssert in wxDoOnAssert() in an exception-safe way (replaces patch 1900613) git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@52079 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- src/common/appbase.cpp | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/src/common/appbase.cpp b/src/common/appbase.cpp index 209241a55b..e7eec2c75e 100644 --- a/src/common/appbase.cpp +++ b/src/common/appbase.cpp @@ -81,6 +81,8 @@ #include "wx/msw/debughlp.h" #endif #endif // wxUSE_STACKWALKER + + #include "wx/recguard.h" #endif // __WXDEBUG__ // wxABI_VERSION can be defined when compiling applications but it should be @@ -826,20 +828,17 @@ static void wxDoOnAssert(const wxString& szFile, const wxString& szMsg = wxEmptyString) { // FIXME MT-unsafe - static bool s_bInAssert = false; + static int s_bInAssert = 0; - if ( s_bInAssert ) + wxRecursionGuard guard(s_bInAssert); + if ( guard.IsInside() ) { - // He-e-e-e-elp!! we're trapped in endless loop + // can't use assert here to avoid infinite loops, so just trap wxTrap(); - s_bInAssert = false; - return; } - s_bInAssert = true; - if ( !wxTheApp ) { // by default, show the assert dialog box -- we can't customize this @@ -853,8 +852,6 @@ static void wxDoOnAssert(const wxString& szFile, wxTheApp->OnAssertFailure(szFile.c_str(), nLine, szFunc.c_str(), szCond.c_str(), szMsg.c_str()); } - - s_bInAssert = false; } void wxOnAssert(const wxString& szFile, -- 2.47.2