share wxEventLoop::IsRunning() implementation between all ports; moved wxEventLoopActivator used by it in wx/evtloop.h instead of duplicating it in 3 different .cpp files (and not using it at all in 3 other ones)

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@36842 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
2006-01-12 16:56:48 +00:00
parent f29d3d6133
commit 77fb1a02aa
11 changed files with 44 additions and 116 deletions

View File

@@ -83,30 +83,6 @@ private:
wxDEFINE_TIED_SCOPED_PTR_TYPE(wxEventLoopImpl);
// this object sets the wxEventLoop given to the ctor as the currently active
// one and unsets it in its dtor
class wxEventLoopActivator
{
public:
wxEventLoopActivator(wxEventLoop **pActive,
wxEventLoop *evtLoop)
{
m_pActive = pActive;
m_evtLoopOld = *pActive;
*pActive = evtLoop;
}
~wxEventLoopActivator()
{
// restore the previously active event loop
*m_pActive = m_evtLoopOld;
}
private:
wxEventLoop *m_evtLoopOld;
wxEventLoop **m_pActive;
};
// ============================================================================
// wxEventLoopImpl implementation
// ============================================================================
@@ -271,7 +247,7 @@ int wxEventLoop::Run()
// SendIdleMessage() and Dispatch() 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(&ms_activeLoop, this);
wxEventLoopActivator activate(this);
wxEventLoopImplTiedPtr impl(&m_impl, new wxEventLoopImpl);
CallEventLoopMethod callOnExit(this, &wxEventLoop::OnExit);