fixed (recently reintroduced) activation bug when the modal dialog was dismissed

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@23930 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
2003-09-26 12:38:49 +00:00
parent afa039f920
commit 2a8f35c325

View File

@@ -240,39 +240,34 @@ int wxEventLoop::Run()
wxEventLoopActivator activate(&ms_activeLoop, this); wxEventLoopActivator activate(&ms_activeLoop, this);
wxEventLoopImplTiedPtr impl(&m_impl, new wxEventLoopImpl); wxEventLoopImplTiedPtr impl(&m_impl, new wxEventLoopImpl);
class CallEventLoopMethod // 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
public: // situations because it is supposed to be called synchronously,
typedef void (wxEventLoop::*FuncType)(); // wxModalEventLoop depends on this (so we can't just use ON_BLOCK_EXIT or
// something similar here)
CallEventLoopMethod(wxEventLoop *evtLoop, FuncType fn) wxTRY
: m_evtLoop(evtLoop), m_fn(fn) { }
~CallEventLoopMethod() { (m_evtLoop->*m_fn)(); }
private:
wxEventLoop *m_evtLoop;
FuncType m_fn;
} callOnExit(this, &wxEventLoop::OnExit);
for ( ;; )
{ {
for ( ;; )
{
#if wxUSE_THREADS #if wxUSE_THREADS
wxMutexGuiLeaveOrEnter(); wxMutexGuiLeaveOrEnter();
#endif // wxUSE_THREADS #endif // wxUSE_THREADS
// generate and process idle events for as long as we don't have // generate and process idle events for as long as we don't have
// anything else to do // anything else to do
while ( !Pending() && m_impl->SendIdleMessage() ) while ( !Pending() && m_impl->SendIdleMessage() )
; ;
// a message came or no more idle processing to do, sit in // a message came or no more idle processing to do, sit in
// Dispatch() waiting for the next message // Dispatch() waiting for the next message
if ( !Dispatch() ) if ( !Dispatch() )
{ {
// we got WM_QUIT // we got WM_QUIT
break; break;
}
} }
} }
wxCATCH_ALL( OnExit(); )
return m_impl->GetExitCode(); return m_impl->GetExitCode();
} }
@@ -283,6 +278,8 @@ void wxEventLoop::Exit(int rc)
m_impl->SetExitCode(rc); m_impl->SetExitCode(rc);
OnExit();
::PostQuitMessage(rc); ::PostQuitMessage(rc);
} }