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
This commit is contained in:
Vadim Zeitlin
2008-02-25 02:51:44 +00:00
parent 3bbd9580df
commit 000eea7a2e

View File

@@ -81,6 +81,8 @@
#include "wx/msw/debughlp.h" #include "wx/msw/debughlp.h"
#endif #endif
#endif // wxUSE_STACKWALKER #endif // wxUSE_STACKWALKER
#include "wx/recguard.h"
#endif // __WXDEBUG__ #endif // __WXDEBUG__
// wxABI_VERSION can be defined when compiling applications but it should be // 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) const wxString& szMsg = wxEmptyString)
{ {
// FIXME MT-unsafe // 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(); wxTrap();
s_bInAssert = false;
return; return;
} }
s_bInAssert = true;
if ( !wxTheApp ) if ( !wxTheApp )
{ {
// by default, show the assert dialog box -- we can't customize this // 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(), wxTheApp->OnAssertFailure(szFile.c_str(), nLine, szFunc.c_str(),
szCond.c_str(), szMsg.c_str()); szCond.c_str(), szMsg.c_str());
} }
s_bInAssert = false;
} }
void wxOnAssert(const wxString& szFile, void wxOnAssert(const wxString& szFile,