Nikolay Sivov : mfplat: Hold platform lock for async results lifetime.
Alexandre Julliard
julliard at winehq.org
Tue Feb 19 15:29:34 CST 2019
Module: wine
Branch: master
Commit: 3d463b8ff581aa6348b84471fa32448127b7bb5c
URL: https://source.winehq.org/git/wine.git/?a=commit;h=3d463b8ff581aa6348b84471fa32448127b7bb5c
Author: Nikolay Sivov <nsivov at codeweavers.com>
Date: Tue Feb 19 16:20:04 2019 +0300
mfplat: Hold platform lock for async results lifetime.
Signed-off-by: Nikolay Sivov <nsivov at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>
---
dlls/mfplat/main.c | 23 +++++++++++++++++++++++
dlls/mfplat/mfplat.spec | 4 ++--
dlls/mfplat/queue.c | 4 ++++
3 files changed, 29 insertions(+), 2 deletions(-)
diff --git a/dlls/mfplat/main.c b/dlls/mfplat/main.c
index 7e1736c..94d5ab0 100644
--- a/dlls/mfplat/main.c
+++ b/dlls/mfplat/main.c
@@ -38,6 +38,8 @@
WINE_DEFAULT_DEBUG_CHANNEL(mfplat);
+static LONG platform_lock;
+
static const WCHAR transform_keyW[] = {'M','e','d','i','a','F','o','u','n','d','a','t','i','o','n','\\',
'T','r','a','n','s','f','o','r','m','s',0};
static const WCHAR categories_keyW[] = {'M','e','d','i','a','F','o','u','n','d','a','t','i','o','n','\\',
@@ -450,6 +452,27 @@ HRESULT WINAPI MFStartup(ULONG version, DWORD flags)
HRESULT WINAPI MFShutdown(void)
{
FIXME("(): stub\n");
+
+ return S_OK;
+}
+
+/***********************************************************************
+ * MFLockPlatform (mfplat.@)
+ */
+HRESULT WINAPI MFLockPlatform(void)
+{
+ InterlockedIncrement(&platform_lock);
+
+ return S_OK;
+}
+
+/***********************************************************************
+ * MFUnlockPlatform (mfplat.@)
+ */
+HRESULT WINAPI MFUnlockPlatform(void)
+{
+ InterlockedDecrement(&platform_lock);
+
return S_OK;
}
diff --git a/dlls/mfplat/mfplat.spec b/dlls/mfplat/mfplat.spec
index b4e6c77..9813789 100644
--- a/dlls/mfplat/mfplat.spec
+++ b/dlls/mfplat/mfplat.spec
@@ -118,7 +118,7 @@
@ stub MFInitVideoFormat_RGB
@ stub MFInvokeCallback
@ stub MFJoinIoPort
-@ stub MFLockPlatform
+@ stdcall MFLockPlatform()
@ stub MFLockWorkQueue
@ stub MFPutWorkItem
@ stub MFPutWorkItemEx
@@ -146,7 +146,7 @@
@ stub MFTraceError
@ stub MFTraceFuncEnter
@ stub MFUnblockThread
-@ stub MFUnlockPlatform
+@ stdcall MFUnlockPlatform()
@ stub MFUnlockWorkQueue
@ stub MFUnwrapMediaType
@ stub MFValidateMediaTypeSize
diff --git a/dlls/mfplat/queue.c b/dlls/mfplat/queue.c
index 762af24..32c7a6c 100644
--- a/dlls/mfplat/queue.c
+++ b/dlls/mfplat/queue.c
@@ -83,6 +83,8 @@ static ULONG WINAPI async_result_Release(IMFAsyncResult *iface)
if (result->state)
IUnknown_Release(result->state);
heap_free(result);
+
+ MFUnlockPlatform();
}
return refcount;
@@ -172,6 +174,8 @@ HRESULT WINAPI MFCreateAsyncResult(IUnknown *object, IMFAsyncCallback *callback,
if (!result)
return E_OUTOFMEMORY;
+ MFLockPlatform();
+
result->result.AsyncResult.lpVtbl = &async_result_vtbl;
result->refcount = 1;
result->object = object;
More information about the wine-cvs
mailing list