[PATCH] comsvcs: Create MTA without initialization thread.
Nikolay Sivov
nsivov at codeweavers.com
Mon Oct 19 04:43:04 CDT 2020
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=49679
Signed-off-by: Nikolay Sivov <nsivov at codeweavers.com>
---
dlls/comsvcs/main.c | 26 +++++---------------------
1 file changed, 5 insertions(+), 21 deletions(-)
diff --git a/dlls/comsvcs/main.c b/dlls/comsvcs/main.c
index 9ab77dfceda..74704077ecb 100644
--- a/dlls/comsvcs/main.c
+++ b/dlls/comsvcs/main.c
@@ -40,7 +40,7 @@ typedef struct dispensermanager
{
IDispenserManager IDispenserManager_iface;
LONG ref;
- HANDLE mta_thread, mta_stop_event;
+ CO_MTA_USAGE_COOKIE mta_cookie;
} dispensermanager;
typedef struct holder
@@ -285,27 +285,14 @@ static ULONG WINAPI dismanager_Release(IDispenserManager *iface)
if (!ref)
{
- if (This->mta_thread)
- {
- SetEvent(This->mta_stop_event);
- WaitForSingleObject(This->mta_thread, INFINITE);
- CloseHandle(This->mta_stop_event);
- CloseHandle(This->mta_thread);
- }
+ if (This->mta_cookie)
+ CoDecrementMTAUsage(This->mta_cookie);
heap_free(This);
}
return ref;
}
-static DWORD WINAPI mta_thread_proc(void *arg)
-{
- CoInitializeEx(NULL, COINIT_MULTITHREADED);
- WaitForSingleObject(arg, INFINITE);
- CoUninitialize();
- return 0;
-}
-
static HRESULT WINAPI dismanager_RegisterDispenser(IDispenserManager *iface, IDispenserDriver *driver,
LPCOLESTR name, IHolder **dispenser)
{
@@ -319,11 +306,8 @@ static HRESULT WINAPI dismanager_RegisterDispenser(IDispenserManager *iface, IDi
hr = create_holder(driver, dispenser);
- if (!This->mta_thread)
- {
- This->mta_stop_event = CreateEventA(NULL, TRUE, FALSE, NULL);
- This->mta_thread = CreateThread(NULL, 0, mta_thread_proc, This->mta_stop_event, 0, NULL);
- }
+ if (!This->mta_cookie)
+ CoIncrementMTAUsage(&This->mta_cookie);
TRACE("<-- 0x%08x, %p\n", hr, *dispenser);
--
2.28.0
More information about the wine-devel
mailing list