Ticket #10052 (confirmed defect)
bogus timer id assertion in wxTimerProc if timer stopped when it is about to fire
| Reported by: | jteh | Owned by: | |
|---|---|---|---|
| Priority: | normal | Milestone: | |
| Component: | wxMSW | Version: | 2.8.x |
| Keywords: | wxTimerWndProc TimerMap KillTimer | Cc: | sobekjunk@… |
| Blocked By: | Patch: | no | |
| Blocking: |
Description
Under Windows, wx sometimes generates "bogus timer id in wxTimerProc" assertion messages if a timer is stopped just before it was about to fire. This is because the WM_TIMER message for the timer has already been posted to the queue, but the win32 KillTimer function (which is called by wxTimer::Stop) does not remove these messages from the queue if they have already been posted. Thus, when the WM_TIMER message for the stopped timer is processed, the timer does not exist anymore, causing the assertion to fail. This behaviour is described in this thread from 2006.
While it is possible to disable assertion messages, this message is not particularly useful even when debugging, especially given this documented behaviour of the win32 KillTimer function. Either this message should be removed for Windows or a way needs to be found to remove the offending WM_TIMER messages from the queue.
My particular case of this issue actually occurs when using wxPython, where I need to disable assertion messages altogether to stop this from causing exceptions. This is obviously undesirable, as there may be other assertion messages that *are* important. My case is described in this thread.
(I didn't file this under wxPython because i believe the issue to be with wxMSW, not wxPython.)
