1. added wxEvtHandler::SafelyProcessEvent() and wxWindow::HandleWindowEvent() to correctly handle exceptions in even handlers in wxGTK
2. use HandleWindowEvent() everywhere as more obvious and convenient shortcut for GetEventHandler()->ProcessEvent(); also for consistency with wxGTK where it's required git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@50329 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -25,6 +25,7 @@
|
||||
#endif
|
||||
|
||||
#include "wx/event.h"
|
||||
#include "wx/evtloop.h"
|
||||
|
||||
#ifndef WX_PRECOMP
|
||||
#include "wx/list.h"
|
||||
@@ -1314,6 +1315,42 @@ bool wxEvtHandler::ProcessEvent(wxEvent& event)
|
||||
return TryParent(event);
|
||||
}
|
||||
|
||||
bool wxEvtHandler::SafelyProcessEvent(wxEvent& event)
|
||||
{
|
||||
#if wxUSE_EXCEPTIONS
|
||||
try
|
||||
{
|
||||
#endif
|
||||
return ProcessEvent(event);
|
||||
#if wxUSE_EXCEPTIONS
|
||||
}
|
||||
catch ( ... )
|
||||
{
|
||||
wxEventLoopBase *loop = wxEventLoopBase::GetActive();
|
||||
try
|
||||
{
|
||||
if ( !wxTheApp || !wxTheApp->OnExceptionInMainLoop() )
|
||||
{
|
||||
if ( loop )
|
||||
loop->Exit();
|
||||
}
|
||||
//else: continue running current event loop
|
||||
|
||||
return false;
|
||||
}
|
||||
catch ( ... )
|
||||
{
|
||||
// OnExceptionInMainLoop() threw, possibly rethrowing the same
|
||||
// exception again: very good, but we still need Exit() to
|
||||
// be called
|
||||
if ( loop )
|
||||
loop->Exit();
|
||||
throw;
|
||||
}
|
||||
}
|
||||
#endif // wxUSE_EXCEPTIONS
|
||||
}
|
||||
|
||||
|
||||
bool wxEvtHandler::SearchEventTable(wxEventTable& table, wxEvent& event)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user