From b6ae7297d2b985a6295fac476bb9d7e74140452a Mon Sep 17 00:00:00 2001 From: Robin Dunn Date: Mon, 15 Feb 2010 17:34:21 +0000 Subject: [PATCH] Apply new patch fixing problem of IsRunning always returning True. See #11699 git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@63486 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- include/wx/msw/private/timer.h | 3 +-- src/msw/timer.cpp | 14 +++----------- 2 files changed, 4 insertions(+), 13 deletions(-) diff --git a/include/wx/msw/private/timer.h b/include/wx/msw/private/timer.h index 0d7958a316..1e70cd387f 100644 --- a/include/wx/msw/private/timer.h +++ b/include/wx/msw/private/timer.h @@ -19,8 +19,7 @@ class WXDLLIMPEXP_BASE wxMSWTimerImpl : public wxTimerImpl { public: - wxMSWTimerImpl(wxTimer *timer); - virtual ~wxMSWTimerImpl(); + wxMSWTimerImpl(wxTimer *timer) : wxTimerImpl(timer) { m_id = 0; }; virtual bool Start(int milliseconds = -1, bool oneShot = false); virtual void Stop(); diff --git a/src/msw/timer.cpp b/src/msw/timer.cpp index 4193755d71..5f31b15104 100644 --- a/src/msw/timer.cpp +++ b/src/msw/timer.cpp @@ -118,22 +118,12 @@ IMPLEMENT_DYNAMIC_CLASS(wxTimerHiddenWindowModule, wxModule) // wxMSWTimerImpl class // ---------------------------------------------------------------------------- -wxMSWTimerImpl::wxMSWTimerImpl(wxTimer *timer) -:wxTimerImpl(timer) -{ - m_id = GetNewTimerId(this); -} - -wxMSWTimerImpl::~wxMSWTimerImpl() -{ - TimerMap().erase(m_id); -} - bool wxMSWTimerImpl::Start(int milliseconds, bool oneShot) { if ( !wxTimerImpl::Start(milliseconds, oneShot) ) return false; + m_id = GetNewTimerId(this); // SetTimer() normally returns just idTimer but this might change in the // future so use its return value to be safe UINT_PTR ret = ::SetTimer @@ -157,6 +147,8 @@ bool wxMSWTimerImpl::Start(int milliseconds, bool oneShot) void wxMSWTimerImpl::Stop() { ::KillTimer(wxTimerHiddenWindowModule::GetHWND(), m_id); + TimerMap().erase(m_id); + m_id = 0; } // ---------------------------------------------------------------------------- -- 2.45.2