From 86c6fc77e16b4d9e21734f0af071f62ebd4237c8 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Mon, 22 Nov 2010 01:22:47 +0000 Subject: [PATCH] Silently ignore timer events from timers which were just stopped. An assert in wxTimerWndProc() could be provoked by valid user code which simply started and stopped the timers quickly enough because a WM_TIMER could have been already generated just before we stopped the timer. Simply ignore events from unknown timer under assumption that they must come from the recently stopped ones instead of asserting. Ideally we'd somehow distinguish between the situation described above and the really bogus events which could indicate bugs in wx code or a change in behaviour in a future version of Windows but there is no easy way to do it so for now just settle for not asserting in normal case. Closes #10052. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@66228 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- src/msw/timer.cpp | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/src/msw/timer.cpp b/src/msw/timer.cpp index 5f31b15104..fae7e00d87 100644 --- a/src/msw/timer.cpp +++ b/src/msw/timer.cpp @@ -173,15 +173,17 @@ LRESULT APIENTRY _EXPORT wxTimerWndProc(HWND hWnd, UINT message, { wxTimerMap::iterator node = TimerMap().find(wParam); - wxCHECK_MSG( node != TimerMap().end(), 0, wxT("bogus timer id in wxTimerProc") ); + if ( node != TimerMap().end() ) + { + wxProcessTimer(*(node->second)); - wxProcessTimer(*(node->second)); - } - else - { - return ::DefWindowProc(hWnd, message, wParam, lParam); + return 0; + } + //else: Unknown timer, probably one of our timers that had fired just + // before being removed from the timers map by Stop(). } - return 0; + + return ::DefWindowProc(hWnd, message, wParam, lParam); } // ---------------------------------------------------------------------------- -- 2.45.2