WM: Fix invalid memory access in wmTimer handling code. 2.93 version #105406

Merged
Philipp Oeser merged 1 commits from mont29/blender:F-2.93-wmtimer-fix into blender-v2.93-release 2023-03-16 12:38:35 +01:00

1 Commits

Author SHA1 Message Date
Bastien Montagne e149018cd4 WM: Fix invalid memory access in wmTimer handling code.
buildbot/vexp-code-patch-coordinator Build done. Details
Timer management code often loops over the list of timers, calling
independant callbacks that end up freeing other timers in the list. That
would result in potentail access-after-free errors, as reported in #105160.

The typical identified scenario is wmTimer calling wmJob code, which
calls some of the job's callbacks (`update` or `end` e.g.), which call
`WM_report`, which removes and add another timer.

To address this issue on a general level, the deletion of timers is now
deferred, with the public API `WM_event_remove_timer` only marking the
timer for deletion, and the private new function
`wm_window_delete_removed_timers` effectively removing and deleting all
marked timers.

This implements design task #105369.

Pull Request #105380
2023-03-03 16:40:35 +01:00