From 59273bac4a749c7e05797791d5266e8ca14d8482 Mon Sep 17 00:00:00 2001 From: Thomas Goyne Date: Thu, 22 Dec 2011 21:17:49 +0000 Subject: [PATCH] Reenable the assertion failure handler Originally committed to SVN as r6053. --- aegisub/src/main.cpp | 4 ++-- aegisub/src/main.h | 8 ++++++++ 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/aegisub/src/main.cpp b/aegisub/src/main.cpp index 10eb47d6c..b5a7f0f2e 100644 --- a/aegisub/src/main.cpp +++ b/aegisub/src/main.cpp @@ -154,11 +154,11 @@ void SetThreadName(DWORD dwThreadID, LPCSTR szThreadName) { /// @param func Function name /// @param cond Condition /// @param msg Message -static void wxAssertHandler(const wxString &file, int line, const wxString &func, const wxString &cond, const wxString &msg) { +void AegisubApp::OnAssertFailure(const wxChar *file, int line, const wxChar *func, const wxChar *cond, const wxChar *msg) { LOG_A("wx/assert") << file << ":" << line << ":" << func << "() " << cond << ": " << msg; + wxApp::OnAssertFailure(file, line, func, cond, msg); } - /// @brief Gets called when application starts. /// @return bool bool AegisubApp::OnInit() { diff --git a/aegisub/src/main.h b/aegisub/src/main.h index 57f5a79a8..e60bc7a7c 100644 --- a/aegisub/src/main.h +++ b/aegisub/src/main.h @@ -114,6 +114,14 @@ class AegisubApp: public wxApp { void OnFatalException(); #endif + /// @brief Handle wx assertions and redirect to the logging system. + /// @param file File name + /// @param line Line number + /// @param func Function name + /// @param cond Condition + /// @param msg Message + void OnAssertFailure(const wxChar *file, int line, const wxChar *func, const wxChar *cond, const wxChar *msg); + // This function wraps all event handler calls anywhere in the application and is // our ticket to catch exceptions happening in event handlers. void HandleEvent(wxEvtHandler *handler, wxEventFunction func, wxEvent& event) const;