From 13436cb53610dc023fadf4370f4bcf789061be59 Mon Sep 17 00:00:00 2001 From: Gunnar Beutner Date: Fri, 8 Mar 2013 14:43:07 +0100 Subject: [PATCH] Catch exceptions in EventQueue::QueueThreadProc. --- lib/base/eventqueue.cpp | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/lib/base/eventqueue.cpp b/lib/base/eventqueue.cpp index 921310e03..ba58ad001 100644 --- a/lib/base/eventqueue.cpp +++ b/lib/base/eventqueue.cpp @@ -103,7 +103,17 @@ void EventQueue::QueueThreadProc(void) # endif /* RUSAGE_THREAD */ #endif /* _DEBUG */ - ev(); + try { + ev(); + } catch (const std::exception& ex) { + stringstream msgbuf; + msgbuf << "Exception thrown in event handler: " << std::endl + << diagnostic_information(ex); + + Logger::Write(LogCritical, "base", msgbuf.str()); + } catch (...) { + Logger::Write(LogCritical, "base", "Exception of unknown type thrown in event handler."); + } #ifdef _DEBUG double et = Utility::GetTime(); -- 2.40.0