always dispatch messages for the hidden window which receives process termination notifications; otherwise calling wxExecute(wxEXEC_SYNC) without an active event loop never returns

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@60733 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin 2009-05-24 19:37:02 +00:00
parent fb4079af5b
commit dbbcfbb642

View File

@ -38,6 +38,7 @@
#include "wx/process.h"
#include "wx/thread.h"
#include "wx/apptrait.h"
#include "wx/evtloop.h"
#include "wx/vector.h"
@ -1007,8 +1008,19 @@ long wxExecute(const wxString& cmd, int flags, wxProcess *handler)
::Sleep(50);
}
// we must process messages or we'd never get wxWM_PROC_TERMINATED
traits->AlwaysYield();
// we must always process messages for our hidden window or we'd never
// get wxWM_PROC_TERMINATED and so this loop would never terminate
MSG msg;
::PeekMessage(&msg, data->hWnd, 0, 0, PM_REMOVE);
// we may also need to process messages for all the other application
// windows
if ( !(flags & wxEXEC_NOEVENTS) )
{
wxEventLoopBase * const loop = wxEventLoopBase::GetActive();
if ( loop )
loop->Yield();
}
}
if ( !(flags & wxEXEC_NODISABLE) )