use standard tied pointer now

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@23646 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
2003-09-17 23:31:58 +00:00
parent 883117d126
commit efbfda9d66

View File

@@ -65,23 +65,7 @@ WX_CHECK_BUILD_OPTIONS("wxCore")
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
// this defines wxEventLoopPtr // this defines wxEventLoopPtr
wxDEFINE_SCOPED_PTR_TYPE(wxEventLoop); wxDEFINE_TIED_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;
};
// ============================================================================ // ============================================================================
// wxAppBase implementation // wxAppBase implementation
@@ -273,7 +257,7 @@ bool wxAppBase::OnCmdLineParsed(wxCmdLineParser& parser)
int wxAppBase::MainLoop() int wxAppBase::MainLoop()
{ {
#if wxUSE_EVTLOOP_IN_APP #if wxUSE_EVTLOOP_IN_APP
wxTiedEventLoopPtr mainLoop(&m_mainLoop, new wxEventLoop); wxEventLoopTiedPtr mainLoop(&m_mainLoop, new wxEventLoop);
return m_mainLoop->Run(); return m_mainLoop->Run();
#else // !wxUSE_EVTLOOP_IN_APP #else // !wxUSE_EVTLOOP_IN_APP