[PATCH v2 5/7] quartz: Clear pending events when disabling notifications.
Zebediah Figura
z.figura12 at gmail.com
Thu Feb 18 16:58:12 CST 2021
Based on a patch by Anton Baskanov.
Signed-off-by: Zebediah Figura <z.figura12 at gmail.com>
---
dlls/quartz/filtergraph.c | 28 ++++++++++++++++++++--------
dlls/quartz/tests/filtergraph.c | 6 +++---
2 files changed, 23 insertions(+), 11 deletions(-)
diff --git a/dlls/quartz/filtergraph.c b/dlls/quartz/filtergraph.c
index a060ee840db..8909ba64024 100644
--- a/dlls/quartz/filtergraph.c
+++ b/dlls/quartz/filtergraph.c
@@ -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;
}
diff --git a/dlls/quartz/tests/filtergraph.c b/dlls/quartz/tests/filtergraph.c
index 6288e3095dd..5d22ba410af 100644
--- a/dlls/quartz/tests/filtergraph.c
+++ b/dlls/quartz/tests/filtergraph.c
@@ -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, ¶m1, ¶m2, 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);
--
2.30.1
More information about the wine-devel
mailing list