Signed-off-by: Zebediah Figura zfigura@codeweavers.com --- dlls/quartz/systemclock.c | 8 ++++++++ dlls/quartz/tests/systemclock.c | 12 ++++++++++-- 2 files changed, 18 insertions(+), 2 deletions(-)
diff --git a/dlls/quartz/systemclock.c b/dlls/quartz/systemclock.c index 597373a4112..73a923a7b99 100644 --- a/dlls/quartz/systemclock.c +++ b/dlls/quartz/systemclock.c @@ -90,6 +90,7 @@ static ULONG WINAPI system_clock_inner_Release(IUnknown *iface) { struct system_clock *clock = impl_from_IUnknown(iface); ULONG refcount = InterlockedDecrement(&clock->refcount); + struct advise_sink *sink, *cursor;
TRACE("%p decreasing refcount to %u.\n", clock, refcount);
@@ -104,6 +105,13 @@ static ULONG WINAPI system_clock_inner_Release(IUnknown *iface) WaitForSingleObject(clock->thread, INFINITE); CloseHandle(clock->thread); } + + LIST_FOR_EACH_ENTRY_SAFE(sink, cursor, &clock->sinks, struct advise_sink, entry) + { + list_remove(&sink->entry); + heap_free(sink); + } + clock->cs.DebugInfo->Spare[0] = 0; DeleteCriticalSection(&clock->cs); heap_free(clock); diff --git a/dlls/quartz/tests/systemclock.c b/dlls/quartz/tests/systemclock.c index fa9464429f0..be5472ed6e1 100644 --- a/dlls/quartz/tests/systemclock.c +++ b/dlls/quartz/tests/systemclock.c @@ -272,11 +272,19 @@ static void test_advise(void) ok(hr == S_OK, "Got hr %#x.\n", hr); ok(WaitForSingleObject(semaphore, 200) == WAIT_TIMEOUT, "Semaphore should not be signaled.\n");
- CloseHandle(event); - CloseHandle(semaphore); + ResetEvent(event); + hr = IReferenceClock_GetTime(clock, ¤t); + ok(SUCCEEDED(hr), "Got hr %#x.\n", hr); + hr = IReferenceClock_AdviseTime(clock, current, 500 * 10000, (HEVENT)event, &cookie); + ok(hr == S_OK, "Got hr %#x.\n", hr);
ref = IReferenceClock_Release(clock); ok(!ref, "Got outstanding refcount %d.\n", ref); + + ok(WaitForSingleObject(event, 0) == WAIT_TIMEOUT, "Event should not be signaled.\n"); + + CloseHandle(event); + CloseHandle(semaphore); }
START_TEST(systemclock)