From 6f63041156d11c168f94529a4def97db711d4029 Mon Sep 17 00:00:00 2001 From: Amar Takhar Date: Tue, 14 Sep 2010 22:05:19 +0000 Subject: [PATCH] Redirect assertions to the logging system. This doesn't create a popup dialogue like the default method does. If someone actually wants that to happen let me know and I'll write something. Originally committed to SVN as r4780. --- aegisub/src/main.cpp | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/aegisub/src/main.cpp b/aegisub/src/main.cpp index bc74920fb..b4dc807a2 100644 --- a/aegisub/src/main.cpp +++ b/aegisub/src/main.cpp @@ -139,15 +139,28 @@ void SetThreadName(DWORD dwThreadID, LPCSTR szThreadName) { #endif -/// @brief Gets called when application starts, creates MainFrame ----------------------- Initialization function -/// @return -/// +/// @brief Handle wx assertions and redirct to the logging system. +/// @param file File name +/// @param line Line number +/// @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) { + LOG_A("wx/assert") << file << ":" << line << ":" << func << "() " << cond << ": " << msg; +} + + +/// @brief Gets called when application starts. +/// @return bool bool AegisubApp::OnInit() { #ifdef _DEBUG emit_stdout = new agi::log::EmitSTDOUT(); emit_stdout->Enable(); #endif + // Install assertion handler + wxSetAssertHandler(wxAssertHandler); + // App name (yeah, this is a little weird to get rid of an odd warning) #if defined(__WXMSW__) || defined(__WXMAC__) SetAppName(_T("Aegisub"));