Nikolay Sivov : mf: Fix GetClock() for shutdown state.
Alexandre Julliard
julliard at winehq.org
Mon Mar 2 16:22:23 CST 2020
Module: wine
Branch: master
Commit: de95a030292324ac199ae014d40fd85a9c6dbed5
URL: https://source.winehq.org/git/wine.git/?a=commit;h=de95a030292324ac199ae014d40fd85a9c6dbed5
Author: Nikolay Sivov <nsivov at codeweavers.com>
Date: Mon Mar 2 13:31:07 2020 +0300
mf: Fix GetClock() for shutdown state.
Signed-off-by: Nikolay Sivov <nsivov at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>
---
dlls/mf/session.c | 12 +++++++++---
dlls/mf/tests/mf.c | 4 ++++
2 files changed, 13 insertions(+), 3 deletions(-)
diff --git a/dlls/mf/session.c b/dlls/mf/session.c
index 0c7e1fbf01..a2a2ba6fe5 100644
--- a/dlls/mf/session.c
+++ b/dlls/mf/session.c
@@ -1364,13 +1364,19 @@ static HRESULT WINAPI mfsession_Shutdown(IMFMediaSession *iface)
static HRESULT WINAPI mfsession_GetClock(IMFMediaSession *iface, IMFClock **clock)
{
struct media_session *session = impl_from_IMFMediaSession(iface);
+ HRESULT hr;
TRACE("%p, %p.\n", iface, clock);
- *clock = (IMFClock *)session->clock;
- IMFClock_AddRef(*clock);
+ EnterCriticalSection(&session->cs);
+ if (SUCCEEDED(hr = session_is_shut_down(session)))
+ {
+ *clock = (IMFClock *)session->clock;
+ IMFClock_AddRef(*clock);
+ }
+ LeaveCriticalSection(&session->cs);
- return S_OK;
+ return hr;
}
static HRESULT WINAPI mfsession_GetSessionCapabilities(IMFMediaSession *iface, DWORD *caps)
diff --git a/dlls/mf/tests/mf.c b/dlls/mf/tests/mf.c
index 8f3a80360f..5f3114da32 100644
--- a/dlls/mf/tests/mf.c
+++ b/dlls/mf/tests/mf.c
@@ -1100,6 +1100,7 @@ todo_wine
hr = IMFClock_GetProperties(clock, &clock_props);
ok(hr == MF_E_CLOCK_NO_TIME_SOURCE, "Unexpected hr %#x.\n", hr);
+ IMFClock_Release(clock);
IMFRateControl_Release(rate_control);
IMFRateSupport_Release(rate_support);
@@ -1117,6 +1118,9 @@ todo_wine
hr = IMFMediaSession_Close(session);
ok(hr == MF_E_SHUTDOWN, "Unexpected hr %#x.\n", hr);
+ hr = IMFMediaSession_GetClock(session, &clock);
+ ok(hr == MF_E_SHUTDOWN, "Unexpected hr %#x.\n", hr);
+
IMFMediaSession_Release(session);
/* Custom topology loader, GUID is not registered. */
More information about the wine-cvs
mailing list