+// ----------------------------------------------------------------------------
+// exception handling
+// ----------------------------------------------------------------------------
+
+#if wxUSE_EXCEPTIONS
+
+void wxAppBase::HandleEvent(wxEvtHandler *handler,
+ wxEventFunction func,
+ wxEvent& event) const
+{
+ // by default, call wxApp::OnExceptionInMainLoop if an exception occurs
+ try
+ {
+ handler->DoHandleEvent(func, event);
+ }
+ catch ( ... )
+ {
+ if ( !wxConstCast(this, wxAppBase)->OnExceptionInMainLoop() )
+ {
+#if wxUSE_EVTLOOP_IN_APP
+ wxEventLoop *loop = wxEventLoop::GetActive();
+ if ( loop )
+ loop->Exit(-1);
+#else
+ wxConstCast(this, wxAppBase)->ExitMainLoop();
+#endif
+ }
+ //else: continue running the event loop
+ }
+}
+
+#endif // wxUSE_EXCEPTIONS
+