From: Piotr Caban <piotr@codeweavers.com> Fixes crash in _Schedule_chore tests. --- dlls/msvcp140/tests/msvcp140.c | 8 ++++++-- dlls/msvcp90/details.c | 3 +-- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/dlls/msvcp140/tests/msvcp140.c b/dlls/msvcp140/tests/msvcp140.c index 48fe66f080e..ab719d9de35 100644 --- a/dlls/msvcp140/tests/msvcp140.c +++ b/dlls/msvcp140/tests/msvcp140.c @@ -704,7 +704,8 @@ static void test__TaskEventLogger(void) static void __cdecl chore_callback(void *arg) { HANDLE event = arg; - SetEvent(event); + if (event) + SetEvent(event); } static void test_chore(void) @@ -715,11 +716,14 @@ static void test_chore(void) int ret; memset(&chore, 0, sizeof(chore)); + chore.callback = chore_callback; ret = p__Schedule_chore(&chore); ok(!ret, "_Schedule_chore returned %d\n", ret); ok(chore.work != NULL, "chore.work == NULL\n"); - ok(!chore.callback, "chore.callback != NULL\n"); + ok(chore.callback == chore_callback, "chore.callback != chore_callback\n"); p__Release_chore(&chore); + ok(!chore.work, "chore.work != NULL\n"); + ok(chore.callback == chore_callback, "chore.callback != chore_callback\n"); chore.work = NULL; chore.callback = chore_callback; diff --git a/dlls/msvcp90/details.c b/dlls/msvcp90/details.c index 7dd7e23e384..9e541e25213 100644 --- a/dlls/msvcp90/details.c +++ b/dlls/msvcp90/details.c @@ -1055,8 +1055,7 @@ static void WINAPI threadpool_callback(PTP_CALLBACK_INSTANCE instance, void *con { _Threadpool_chore *chore = context; TRACE("calling chore callback: %p\n", chore); - if (chore->callback) - chore->callback(chore->arg); + chore->callback(chore->arg); } /* ?_Schedule_chore@details@Concurrency@@YAHPAU_Threadpool_chore@12@@Z */ -- GitLab https://gitlab.winehq.org/wine/wine/-/merge_requests/10165