From d00077abbe42b2fe08d5054519499dee4e93cf98 Mon Sep 17 00:00:00 2001 From: Robin Dunn Date: Sat, 10 Jun 2006 03:31:01 +0000 Subject: [PATCH] Switch to overriding OnAssertFailure instead of OnAssert git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@39659 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- wxPython/include/wx/wxPython/wxPython_int.h | 9 ++--- wxPython/src/helpers.cpp | 39 +++++++++++---------- 2 files changed, 26 insertions(+), 22 deletions(-) diff --git a/wxPython/include/wx/wxPython/wxPython_int.h b/wxPython/include/wx/wxPython/wxPython_int.h index 8aaf5f46ba..26aa87d7f8 100644 --- a/wxPython/include/wx/wxPython/wxPython_int.h +++ b/wxPython/include/wx/wxPython/wxPython_int.h @@ -602,10 +602,11 @@ public: virtual bool OnInitGui(); virtual int OnExit(); #ifdef __WXDEBUG__ - virtual void OnAssert(const wxChar *file, - int line, - const wxChar *cond, - const wxChar *msg); + virtual void OnAssertFailure(const wxChar *file, + int line, + const wxChar *func, + const wxChar *cond, + const wxChar *msg); #endif virtual void ExitMainLoop(); // virtual int FilterEvent(wxEvent& event); // This one too???? diff --git a/wxPython/src/helpers.cpp b/wxPython/src/helpers.cpp index 572ada736f..470815f267 100644 --- a/wxPython/src/helpers.cpp +++ b/wxPython/src/helpers.cpp @@ -191,21 +191,23 @@ void wxPyApp::ExitMainLoop() { #ifdef __WXDEBUG__ -void wxPyApp::OnAssert(const wxChar *file, - int line, - const wxChar *cond, - const wxChar *msg) { - +void wxPyApp::OnAssertFailure(const wxChar *file, + int line, + const wxChar *func, + const wxChar *cond, + const wxChar *msg) +{ // if we're not fully initialized then just log the error if (! m_startupComplete) { wxString buf; buf.Alloc(4096); buf.Printf(wxT("%s(%d): assert \"%s\" failed"), file, line, cond); - if (msg != NULL) { - buf += wxT(": "); - buf += msg; - } + if ( func && *func ) + buf << wxT(" in ") << func << wxT("()"); + if (msg != NULL) + buf << wxT(": ") << msg; + wxLogDebug(buf); return; } @@ -239,11 +241,12 @@ void wxPyApp::OnAssert(const wxChar *file, if (m_assertMode & wxPYAPP_ASSERT_EXCEPTION) { wxString buf; buf.Alloc(4096); - buf.Printf(wxT("C++ assertion \"%s\" failed in %s(%d)"), cond, file, line); - if (msg != NULL) { - buf += wxT(": "); - buf += msg; - } + buf.Printf(wxT("C++ assertion \"%s\" failed at %s(%d)"), cond, file, line); + if ( func && *func ) + buf << wxT(" in ") << func << wxT("()"); + if (msg != NULL) + buf << wxT(": ") << msg; + // set the exception wxPyBlock_t blocked = wxPyBeginBlockThreads(); @@ -264,10 +267,10 @@ void wxPyApp::OnAssert(const wxChar *file, buf.Alloc(4096); buf.Printf(wxT("%s(%d): assert \"%s\" failed"), file, line, cond); - if (msg != NULL) { - buf += wxT(": "); - buf += msg; - } + if ( func && *func ) + buf << wxT(" in ") << func << wxT("()"); + if (msg != NULL) + buf << wxT(": ") << msg; wxLogDebug(buf); } -- 2.47.2