changed exceptions handling to work under wxGTK
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@34717 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -207,74 +207,48 @@ int wxEventLoop::Run()
|
||||
// should undo
|
||||
wxEventLoopActivator activate(&ms_activeLoop, this);
|
||||
|
||||
// we must ensure that OnExit() is called even if an exception is thrown
|
||||
// from inside Dispatch() but we must call it from Exit() in normal
|
||||
// situations because it is supposed to be called synchronously,
|
||||
// wxModalEventLoop depends on this (so we can't just use ON_BLOCK_EXIT or
|
||||
// something similar here)
|
||||
#if wxUSE_EXCEPTIONS
|
||||
for ( ;; )
|
||||
try
|
||||
{
|
||||
try
|
||||
#endif
|
||||
// this is the event loop itself
|
||||
for ( ;; )
|
||||
{
|
||||
#endif // wxUSE_EXCEPTIONS
|
||||
#if wxUSE_THREADS
|
||||
wxMutexGuiLeaveOrEnter();
|
||||
#endif // wxUSE_THREADS
|
||||
|
||||
// this is the event loop itself
|
||||
for ( ;; )
|
||||
// generate and process idle events for as long as we don't
|
||||
// have anything else to do
|
||||
while ( !Pending() && (wxTheApp && wxTheApp->ProcessIdle()) )
|
||||
;
|
||||
|
||||
// if the "should exit" flag is set, the loop should terminate
|
||||
// but not before processing any remaining messages so while
|
||||
// Pending() returns true, do process them
|
||||
if ( m_shouldExit )
|
||||
{
|
||||
#if wxUSE_THREADS
|
||||
wxMutexGuiLeaveOrEnter();
|
||||
#endif // wxUSE_THREADS
|
||||
while ( Pending() )
|
||||
Dispatch();
|
||||
|
||||
// generate and process idle events for as long as we don't
|
||||
// have anything else to do
|
||||
while ( !Pending() && (wxTheApp && wxTheApp->ProcessIdle()) )
|
||||
;
|
||||
|
||||
// if the "should exit" flag is set, the loop should terminate
|
||||
// but not before processing any remaining messages so while
|
||||
// Pending() returns true, do process them
|
||||
if ( m_shouldExit )
|
||||
{
|
||||
while ( Pending() )
|
||||
Dispatch();
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
// a message came or no more idle processing to do, sit in
|
||||
// Dispatch() waiting for the next message
|
||||
if ( !Dispatch() )
|
||||
{
|
||||
// we got WM_QUIT
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
// a message came or no more idle processing to do, sit in
|
||||
// Dispatch() waiting for the next message
|
||||
if ( !Dispatch() )
|
||||
{
|
||||
// we got WM_QUIT
|
||||
break;
|
||||
}
|
||||
}
|
||||
#if wxUSE_EXCEPTIONS
|
||||
// exit the outer loop as well
|
||||
break;
|
||||
}
|
||||
catch ( ... )
|
||||
{
|
||||
try
|
||||
{
|
||||
if ( !wxTheApp || !wxTheApp->OnExceptionInMainLoop() )
|
||||
{
|
||||
OnExit();
|
||||
break;
|
||||
}
|
||||
//else: continue running the event loop
|
||||
}
|
||||
catch ( ... )
|
||||
{
|
||||
// OnException() throwed, possibly rethrowing the same
|
||||
// exception again: very good, but we still need OnExit() to
|
||||
// be called
|
||||
OnExit();
|
||||
throw;
|
||||
}
|
||||
}
|
||||
}
|
||||
catch ( ... )
|
||||
{
|
||||
// we need OnExit() to be called before the event loop stops
|
||||
OnExit();
|
||||
throw;
|
||||
}
|
||||
#endif // wxUSE_EXCEPTIONS
|
||||
|
||||
|
Reference in New Issue
Block a user