You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Windows: HWnd::create_timer leaks an extra thread timer #362
In src/wrappers/win32/window/handle.rs, HWnd::create_timer() calls SetTimer(NULL, 0, ...) to obtain an ID, then reset_timer() calls SetTimer(hwnd, id, ...).
These are two separate timers. kill_timer() calls KillTimer(hwnd, id), which stops only the window-owned timer. The original thread timer remains active, including after the window is destroyed. It also leaks if reset_timer() fails.
Repeated timer creation and cancellation therefore accumulates orphaned thread timers.
Observed impact
With continuous redraws, the UI became progressively choppy and froze after several minutes, including while idle. Closing and reopening the window could leave it black.
Fix applied locally
Removed the initial SetTimer(NULL, 0, ...) call and instead allocated unique, nonzero IDs using an overflow-checked atomic counter. create_timer() then creates only the window-owned timer through the existing reset_timer().
reset_timer() and kill_timer() remain unchanged. Creation, reset, and cancellation now use the same HWND/ID pair, and window destruction cleans up the timer. The counter cannot wrap and reuse live IDs.
With the local fix applied, the Windows UI remained open for approximately 30 minutes without freezing or progressive slowdown and stayed fast and responsive.
Activity
prokopyl commentedon Oct 26, 2026
#365 fixes the issue on my end, can you check if it also fixes it on your system?
tenshiak commentedon Oct 26, 2026
I tried it. It seems to work just fine!