1
0
mirror of https://github.com/wine-mirror/wine synced 2024-06-29 06:14:34 +00:00
wine/dlls/rtworkq
Yuxuan Shui cf24381899 rtworkq: Release cancelled work items.
Usually the threadpool holds a reference to the `work_item`, which is released when the `work_item`'s
callback is invoked. On the other hand, `queue_cancel_item` closes the threadpool object without
releasing the `work_item`. So if the callbacks don't get a chance to run - which is not guaranteed -
the `work_item` will be leaked.

The fix is not as simple as adding a `IUnknown_Release` to `queue_cancel_item`, because the
`work_item`'s callback can still be called after CloseThreadpoolTimer/Wait has returned. In fact its
callback might currently be running. In which case the callback will access freed memory if
`queue_cancel_item` frees the `work_item`.

We have to stop any further callbacks to be queued, wait for any currently running callbacks to
finish, then finally we can release the `work_item` if it hasn't already been freed during the wait.
2024-05-12 16:32:53 +02:00
..
tests makefiles: Always use the global SOURCES variable for .c files. 2023-11-01 22:44:03 +01:00
Makefile.in makefiles: Always use the global SOURCES variable for .c files. 2023-11-01 22:44:03 +01:00
queue.c rtworkq: Release cancelled work items. 2024-05-12 16:32:53 +02:00
rtworkq.spec