X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/d1fc6f065885a749930c86fdb0200f3220ad86b5..5955710c8bd346e8be675bd1dbbd427723a57920:/src/common/appcmn.cpp diff --git a/src/common/appcmn.cpp b/src/common/appcmn.cpp index a76039c80f..0f013b66d3 100644 --- a/src/common/appcmn.cpp +++ b/src/common/appcmn.cpp @@ -65,23 +65,7 @@ WX_CHECK_BUILD_OPTIONS("wxCore") // ---------------------------------------------------------------------------- // this defines wxEventLoopPtr -wxDEFINE_SCOPED_PTR_TYPE(wxEventLoop); - -// but we need a smart pointer tied to wxAppBase::m_mainLoop, so we define -// another helper class -class wxTiedEventLoopPtr : public wxEventLoopPtr -{ -public: - wxTiedEventLoopPtr(wxEventLoop **ppEvtLoop, wxEventLoop *pLoop) - : wxEventLoopPtr(*ppEvtLoop = pLoop), m_ppEvtLoop(ppEvtLoop) - { - } - - ~wxTiedEventLoopPtr() { *m_ppEvtLoop = NULL; } - -private: - wxEventLoop **m_ppEvtLoop; -}; +wxDEFINE_TIED_SCOPED_PTR_TYPE(wxEventLoop); // ============================================================================ // wxAppBase implementation @@ -156,10 +140,10 @@ void wxAppBase::CleanUp() delete wxTheColourDatabase; wxTheColourDatabase = NULL; -#if wxUSE_THREADS delete wxPendingEvents; wxPendingEvents = NULL; +#if wxUSE_THREADS delete wxPendingEventsLocker; wxPendingEventsLocker = NULL; @@ -273,7 +257,7 @@ bool wxAppBase::OnCmdLineParsed(wxCmdLineParser& parser) int wxAppBase::MainLoop() { #if wxUSE_EVTLOOP_IN_APP - wxTiedEventLoopPtr mainLoop(&m_mainLoop, new wxEventLoop); + wxEventLoopTiedPtr mainLoop(&m_mainLoop, new wxEventLoop); return m_mainLoop->Run(); #else // !wxUSE_EVTLOOP_IN_APP @@ -286,7 +270,7 @@ void wxAppBase::ExitMainLoop() #if wxUSE_EVTLOOP_IN_APP // we should exit from the main event loop, not just any currently active // (e.g. modal dialog) event loop - if ( m_mainLoop ) + if ( m_mainLoop && m_mainLoop->IsRunning() ) { m_mainLoop->Exit(0); }