Factor out exception handling code in a new WXConsumeException()
This will allow using this code from other places and not only when executing user-defined event handlers. No changes in this commit yet.
This commit is contained in:
@@ -3386,6 +3386,18 @@ public:
|
|||||||
// NOTE: uses AddPendingEvent(); call only from secondary threads
|
// NOTE: uses AddPendingEvent(); call only from secondary threads
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if wxUSE_EXCEPTIONS
|
||||||
|
// This is a private function which handles any exceptions arising during
|
||||||
|
// the execution of user-defined code called in the event loop context by
|
||||||
|
// forwarding them to wxApp::OnExceptionInMainLoop() and, if it rethrows,
|
||||||
|
// to wxApp::OnUnhandledException(). In any case this function ensures that
|
||||||
|
// no exceptions ever escape from it and so is useful to call at module
|
||||||
|
// boundary.
|
||||||
|
//
|
||||||
|
// It must be only called when handling an active exception.
|
||||||
|
static void WXConsumeException();
|
||||||
|
#endif // wxUSE_EXCEPTIONS
|
||||||
|
|
||||||
#ifdef wxHAS_CALL_AFTER
|
#ifdef wxHAS_CALL_AFTER
|
||||||
// Asynchronous method calls: these methods schedule the given method
|
// Asynchronous method calls: these methods schedule the given method
|
||||||
// pointer for a later call (during the next idle event loop iteration).
|
// pointer for a later call (during the next idle event loop iteration).
|
||||||
|
@@ -1604,6 +1604,17 @@ bool wxEvtHandler::SafelyProcessEvent(wxEvent& event)
|
|||||||
}
|
}
|
||||||
catch ( ... )
|
catch ( ... )
|
||||||
{
|
{
|
||||||
|
WXConsumeException();
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
#endif // wxUSE_EXCEPTIONS
|
||||||
|
}
|
||||||
|
|
||||||
|
#if wxUSE_EXCEPTIONS
|
||||||
|
/* static */
|
||||||
|
void wxEvtHandler::WXConsumeException()
|
||||||
|
{
|
||||||
wxEventLoopBase * const loop = wxEventLoopBase::GetActive();
|
wxEventLoopBase * const loop = wxEventLoopBase::GetActive();
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
@@ -1662,12 +1673,10 @@ bool wxEvtHandler::SafelyProcessEvent(wxEvent& event)
|
|||||||
wxAbort();
|
wxAbort();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
return false;
|
|
||||||
#endif // wxUSE_EXCEPTIONS
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#endif // wxUSE_EXCEPTIONS
|
||||||
|
|
||||||
bool wxEvtHandler::SearchEventTable(wxEventTable& table, wxEvent& event)
|
bool wxEvtHandler::SearchEventTable(wxEventTable& table, wxEvent& event)
|
||||||
{
|
{
|
||||||
const wxEventType eventType = event.GetEventType();
|
const wxEventType eventType = event.GetEventType();
|
||||||
|
Reference in New Issue
Block a user