Commit aab10e6c authored by Zebediah Figura's avatar Zebediah Figura Committed by Alexandre Julliard

quartz: Clear pending events when disabling notifications.

Based on a patch by Anton Baskanov. Signed-off-by: 's avatarZebediah Figura <z.figura12@gmail.com> Signed-off-by: 's avatarAlexandre Julliard <julliard@winehq.org>
parent 99c09872
......@@ -319,6 +319,19 @@ static BOOL queue_media_event(struct filter_graph *graph, LONG code,
return TRUE;
}
static void flush_media_events(struct filter_graph *graph)
{
struct list *cursor;
while ((cursor = list_head(&graph->media_events)))
{
struct media_event *event = LIST_ENTRY(cursor, struct media_event, entry);
list_remove(&event->entry);
free(event);
}
}
static struct filter_graph *impl_from_IUnknown(IUnknown *iface)
{
return CONTAINING_RECORD(iface, struct filter_graph, IUnknown_inner);
......@@ -443,14 +456,7 @@ static ULONG WINAPI FilterGraphInner_Release(IUnknown *iface)
if (This->pSite) IUnknown_Release(This->pSite);
while ((cursor = list_head(&This->media_events)))
{
struct media_event *event = LIST_ENTRY(cursor, struct media_event, entry);
list_remove(&event->entry);
free(event);
}
flush_media_events(This);
CloseHandle(This->media_event_handle);
This->cs.DebugInfo->Spare[0] = 0;
......@@ -4850,6 +4856,12 @@ static HRESULT WINAPI MediaEvent_SetNotifyFlags(IMediaEventEx *iface, LONG flags
graph->media_events_disabled = flags;
if (flags)
{
flush_media_events(graph);
ResetEvent(graph->media_event_handle);
}
return S_OK;
}
......
......@@ -5215,10 +5215,10 @@ static void test_set_notify_flags(void)
ok(hr == S_OK, "Got hr %#x.\n", hr);
ok(flags == AM_MEDIAEVENT_NONOTIFY, "Got flags %#x\n", flags);
todo_wine ok(WaitForSingleObject(event, 0) == WAIT_TIMEOUT, "Event should not be signaled.\n");
ok(WaitForSingleObject(event, 0) == WAIT_TIMEOUT, "Event should not be signaled.\n");
hr = IMediaEventEx_GetEvent(media_event, &code, &param1, &param2, 50);
todo_wine ok(hr == E_ABORT, "Got hr %#x.\n", hr);
ok(hr == E_ABORT, "Got hr %#x.\n", hr);
hr = IMediaEventSink_Notify(media_event_sink, EC_STATUS, (LONG_PTR)status, (LONG_PTR)status);
ok(hr == S_OK, "Got hr %#x.\n", hr);
......@@ -5282,7 +5282,7 @@ static void test_set_notify_flags(void)
hr = IMediaEventEx_SetNotifyFlags(media_event, AM_MEDIAEVENT_NONOTIFY);
ok(hr == S_OK, "Got hr %#x.\n", hr);
todo_wine ok(WaitForSingleObject(event, 0) == WAIT_TIMEOUT, "Event should not be signaled.\n");
ok(WaitForSingleObject(event, 0) == WAIT_TIMEOUT, "Event should not be signaled.\n");
hr = IMediaControl_Stop(media_control);
ok(hr == S_OK, "Got hr %#x.\n", hr);
......
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