Skip to content

Race condition in timer handling #37

@User4martin

Description

@User4martin

https://learn.microsoft.com/en-us/windows/win32/api/winuser/nf-winuser-killtimer#remarks

The KillTimer function does not remove WM_TIMER messages already posted to the message queue.

That means that ever if VTV killed a timer, it may still get the message. The procedure TBaseVirtualTree.WMTimer does not check if that message is still expected and will execute it.

If a EditTimer was scheduled (for whatever node was focused), but got killed by a mouse click (which as side effect would have moved the focus to another node, then the event could still be triggered, but would be applied to the new focused node.

Not checked, but likely similar issues can arise with other KillTimers.


I propose to have a set of flags (array , enumerated-set, bitmask, ...) to indicate which events are really expected. The flags could be removed in Killtimer (StopTimer) and the event prevented.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions