From b76f0023ae275de2d71ed735a95d2ecb81d4ea74 Mon Sep 17 00:00:00 2001
From: Vadim Zeitlin <vadim@wxwidgets.org>
Date: Tue, 30 Mar 2004 20:49:54 +0000
Subject: [PATCH] added and documented wxApp::OnExceptionInMainLoop()

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@26505 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
---
 docs/latex/wx/app.tex | 19 +++++++++++++++++++
 include/wx/app.h      |  6 ++++++
 2 files changed, 25 insertions(+)

diff --git a/docs/latex/wx/app.tex b/docs/latex/wx/app.tex
index d02fd5a8cb..138eba959c 100644
--- a/docs/latex/wx/app.tex
+++ b/docs/latex/wx/app.tex
@@ -320,6 +320,25 @@ Return {\tt true} to continue normal execution or {\tt false} to return
 \helpref{OnInitCmdLine}{wxapponinitcmdline}
 
 
+\membersection{wxApp::OnExceptionInMainLoop}{wxapponexceptioninmainloop}
+
+\func{virtual bool}{OnExceptionInMainLoop}{\void}
+
+This function is called if an unhandled exception occurs inside the main
+application event loop. It can return \true to ignore the exception and to
+continue running the loop or \false to exit the loop and terminate the
+program. In the latter case it can also use C++ \texttt{throw} keyword to
+rethrow the current exception.
+
+The default behaviour of this function is the latter in all ports except under
+Windows where a dialog is shown to the user which allows him to choose between
+the different options. You may override this function in your class to do
+something more appropriate.
+
+Finally note that if the exception is rethrown from here, it can be caught in 
+\helpref{OnUnhandledException}{wxapponunhandledexception}.
+
+
 \membersection{wxApp::OnExit}\label{wxapponexit}
 
 \func{virtual int}{OnExit}{\void}
diff --git a/include/wx/app.h b/include/wx/app.h
index f172a41422..85ba83f552 100644
--- a/include/wx/app.h
+++ b/include/wx/app.h
@@ -117,6 +117,12 @@ public:
     virtual void OnFatalException() { }
 
 #if wxUSE_EXCEPTIONS
+    // function called if an uncaught exception is caught inside the main
+    // event loop: it may return true to continue running the event loop or
+    // false to stop it (in the latter case it may rethrow the exception as
+    // well)
+    virtual bool OnExceptionInMainLoop() { throw; }
+
     // Called when an unhandled C++ exception occurs inside OnRun(): note that
     // the exception type is lost by now, so if you really want to handle the
     // exception you should override OnRun() and put a try/catch around
-- 
2.50.0

