On Fri Jul 22 20:00:36 2022 +0000, Piotr Caban wrote:
This will crash if chore is executed after context is destroyed. I don't know how it's supposed to work but if it doesn't crash with native, I will prefer something along these lines (not tested): ```c if (!list_empty(&this->scheduled_chores)) FIXME("scheduled chores list is not empty\n"); while (!list_empty(&this->scheduled_chores)) { entry = list_head(&this->scheduled_chores); list_remove(entry); LeaveCriticalSection(&this->scheduled_chores_cs); sc = LIST_ENTRY(entry, struct scheduled_chore, entry); chore = sc->chore; operator_delete(sc); _StructuredTaskCollection_RunAndWait(chore->task_collection, chore); EnterCriticalSection(&this->scheduled_chores_cs); } ``` Unfortunately it may be tricky to test depending how context caching works (another option is to cancel the task collections). FWIW I think that incorrect solution is better than a crash. I opted to not do this for now because running chores do not block thread exits, and there is refcounting so this case should not be hit anyway. If I should still add this please let me know.
-- https://gitlab.winehq.org/wine/wine/-/merge_requests/464#note_5070