From: Tim Clem <tclem(a)codeweavers.com> Fixes a regression with 672c3a561f5. --- server/mutex.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/server/mutex.c b/server/mutex.c index 573fcda1083..f92ecb6610e 100644 --- a/server/mutex.c +++ b/server/mutex.c @@ -267,7 +267,11 @@ static void mutex_destroy( struct object *obj ) { struct mutex *mutex = (struct mutex *)obj; assert( obj->ops == &mutex_ops ); - if (mutex->sync) release_object( mutex->sync ); + if (mutex->sync) + { + if (mutex->sync->count) do_release( mutex->sync, current, mutex->sync->count ); + release_object( mutex->sync ); + } } /* create a mutex */ -- GitLab https://gitlab.winehq.org/wine/wine/-/merge_requests/8538