+ // 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);
+ wxEventLoopImplTiedPtr impl(&m_impl, new wxEventLoopImpl);
+
+ class CallEventLoopMethod
+ {
+ public:
+ typedef void (wxEventLoop::*FuncType)();
+
+ CallEventLoopMethod(wxEventLoop *evtLoop, FuncType fn)
+ : m_evtLoop(evtLoop), m_fn(fn) { }
+ ~CallEventLoopMethod() { (m_evtLoop->*m_fn)(); }
+
+ private:
+ wxEventLoop *m_evtLoop;
+ FuncType m_fn;
+ } callOnExit(this, wxEventLoop::OnExit);