Hi, Zebediah. Thank you for your quick reply.

It was a very interesting problem and I logged the changes in object_locks.
In my tests, object_locks goes to 0 without system_clock_inner_Release being called.
The game I tested does not have a free version, so I apologize for not sharing it. The game is clickable to skip video playback, and the crash occurs when clicking.

I have attached the log of my test for your reference. Thank you,

2021年8月11日(水) 7:52 Zebediah Figura (she/her) <zfigura@codeweavers.com>:
Hello Hiroki, thanks for the patch!

On 8/10/21 5:38 PM, Hiroki Awata wrote:
> Some games crash when the DLL is unloaded during SleepConditionVariableCS on SystemClockAdviseThread.
> This is due to the fact that DllCanUnloadNow returns S_OK even though the advise thread is running.
> Incrementing the reference count when creating the advise thread resolves it.

This doesn't seem right; the system clock object itself should be
holding a reference [added by DSCF_CreateInstance(), removed by
system_clock_inner_Release()] and waits for the thread to stop before
removing it. Are you sure we're not leaking a reference elsewhere?