From: Robin Dunn <robin@alldunn.com>
Date: Sat, 10 Jun 2006 03:31:01 +0000 (+0000)
Subject: Switch to overriding OnAssertFailure instead of OnAssert
X-Git-Url: https://git.saurik.com/wxWidgets.git/commitdiff_plain/d00077abbe42b2fe08d5054519499dee4e93cf98?ds=inline

Switch to overriding OnAssertFailure instead of OnAssert


git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@39659 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
---

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);
         }