Switch to overriding OnAssertFailure instead of OnAssert
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@39659 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -602,10 +602,11 @@ public:
|
|||||||
virtual bool OnInitGui();
|
virtual bool OnInitGui();
|
||||||
virtual int OnExit();
|
virtual int OnExit();
|
||||||
#ifdef __WXDEBUG__
|
#ifdef __WXDEBUG__
|
||||||
virtual void OnAssert(const wxChar *file,
|
virtual void OnAssertFailure(const wxChar *file,
|
||||||
int line,
|
int line,
|
||||||
const wxChar *cond,
|
const wxChar *func,
|
||||||
const wxChar *msg);
|
const wxChar *cond,
|
||||||
|
const wxChar *msg);
|
||||||
#endif
|
#endif
|
||||||
virtual void ExitMainLoop();
|
virtual void ExitMainLoop();
|
||||||
// virtual int FilterEvent(wxEvent& event); // This one too????
|
// virtual int FilterEvent(wxEvent& event); // This one too????
|
||||||
|
@@ -191,21 +191,23 @@ void wxPyApp::ExitMainLoop() {
|
|||||||
|
|
||||||
|
|
||||||
#ifdef __WXDEBUG__
|
#ifdef __WXDEBUG__
|
||||||
void wxPyApp::OnAssert(const wxChar *file,
|
void wxPyApp::OnAssertFailure(const wxChar *file,
|
||||||
int line,
|
int line,
|
||||||
const wxChar *cond,
|
const wxChar *func,
|
||||||
const wxChar *msg) {
|
const wxChar *cond,
|
||||||
|
const wxChar *msg)
|
||||||
|
{
|
||||||
// if we're not fully initialized then just log the error
|
// if we're not fully initialized then just log the error
|
||||||
if (! m_startupComplete) {
|
if (! m_startupComplete) {
|
||||||
wxString buf;
|
wxString buf;
|
||||||
buf.Alloc(4096);
|
buf.Alloc(4096);
|
||||||
buf.Printf(wxT("%s(%d): assert \"%s\" failed"),
|
buf.Printf(wxT("%s(%d): assert \"%s\" failed"),
|
||||||
file, line, cond);
|
file, line, cond);
|
||||||
if (msg != NULL) {
|
if ( func && *func )
|
||||||
buf += wxT(": ");
|
buf << wxT(" in ") << func << wxT("()");
|
||||||
buf += msg;
|
if (msg != NULL)
|
||||||
}
|
buf << wxT(": ") << msg;
|
||||||
|
|
||||||
wxLogDebug(buf);
|
wxLogDebug(buf);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -239,11 +241,12 @@ void wxPyApp::OnAssert(const wxChar *file,
|
|||||||
if (m_assertMode & wxPYAPP_ASSERT_EXCEPTION) {
|
if (m_assertMode & wxPYAPP_ASSERT_EXCEPTION) {
|
||||||
wxString buf;
|
wxString buf;
|
||||||
buf.Alloc(4096);
|
buf.Alloc(4096);
|
||||||
buf.Printf(wxT("C++ assertion \"%s\" failed in %s(%d)"), cond, file, line);
|
buf.Printf(wxT("C++ assertion \"%s\" failed at %s(%d)"), cond, file, line);
|
||||||
if (msg != NULL) {
|
if ( func && *func )
|
||||||
buf += wxT(": ");
|
buf << wxT(" in ") << func << wxT("()");
|
||||||
buf += msg;
|
if (msg != NULL)
|
||||||
}
|
buf << wxT(": ") << msg;
|
||||||
|
|
||||||
|
|
||||||
// set the exception
|
// set the exception
|
||||||
wxPyBlock_t blocked = wxPyBeginBlockThreads();
|
wxPyBlock_t blocked = wxPyBeginBlockThreads();
|
||||||
@@ -264,10 +267,10 @@ void wxPyApp::OnAssert(const wxChar *file,
|
|||||||
buf.Alloc(4096);
|
buf.Alloc(4096);
|
||||||
buf.Printf(wxT("%s(%d): assert \"%s\" failed"),
|
buf.Printf(wxT("%s(%d): assert \"%s\" failed"),
|
||||||
file, line, cond);
|
file, line, cond);
|
||||||
if (msg != NULL) {
|
if ( func && *func )
|
||||||
buf += wxT(": ");
|
buf << wxT(" in ") << func << wxT("()");
|
||||||
buf += msg;
|
if (msg != NULL)
|
||||||
}
|
buf << wxT(": ") << msg;
|
||||||
wxLogDebug(buf);
|
wxLogDebug(buf);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user