Add wxEventLoopBase::DoRun().

Call it from public Run() after setting the loop as active and resetting
m_shouldExit flag.

No real changes, just cut down on the code duplication among the ports and
make it easier to implement the upcoming changes. see #10258.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@74333 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
2013-07-03 00:25:23 +00:00
parent a1fe5f9048
commit c738d187e9
11 changed files with 47 additions and 60 deletions

View File

@@ -52,6 +52,24 @@ void wxEventLoopBase::SetActive(wxEventLoopBase* loop)
wxTheApp->OnEventLoopEnter(loop);
}
int wxEventLoopBase::Run()
{
// event loops are not recursive, you need to create another loop!
wxCHECK_MSG( !IsRunning(), -1, wxT("can't reenter a message loop") );
// ProcessIdle() and ProcessEvents() below may throw so the code here should
// be exception-safe, hence we must use local objects for all actions we
// should undo
wxEventLoopActivator activate(this);
// We might be called again, after a previous call to ScheduleExit(), so
// reset this flag.
m_shouldExit = false;
// Finally really run the loop.
return DoRun();
}
void wxEventLoopBase::OnExit()
{
if (wxTheApp)
@@ -118,16 +136,8 @@ bool wxEventLoopManual::ProcessEvents()
return Dispatch();
}
int wxEventLoopManual::Run()
int wxEventLoopManual::DoRun()
{
// event loops are not recursive, you need to create another loop!
wxCHECK_MSG( !IsRunning(), -1, wxT("can't reenter a message loop") );
// ProcessIdle() and ProcessEvents() below may throw so the code here should
// be exception-safe, hence we must use local objects for all actions we
// should undo
wxEventLoopActivator activate(this);
// we must ensure that OnExit() is called even if an exception is thrown
// from inside ProcessEvents() but we must call it from Exit() in normal
// situations because it is supposed to be called synchronously,