Commit 4e74fdce authored by Zebediah Figura's avatar Zebediah Figura Committed by Alexandre Julliard

quartz: Free outstanding advise requests when destroying a system clock.

parent ff231dad
......@@ -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);
......
......@@ -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, &current);
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)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment