From b587de60d4e6aa96238766272d94f1499b22f696 Mon Sep 17 00:00:00 2001 From: Julien Nabet Date: Fri, 22 May 2020 14:33:24 +0200 Subject: Prefer CoInitializeEx instead of CoInitialize As https://docs.microsoft.com/fr-fr/windows/win32/api/objbase/nf-objbase-coinitialize?redirectedfrom=MSDN advised. Moreover, it'll make concurrency model explicit Change-Id: I247a49248bf45beb64a7985a7c0d078ee48efe2d Change-Id: I6e755fd516d9fb2dd2a9df0c66d9afd6070447ea Reviewed-on: https://gerrit.libreoffice.org/c/core/+/94669 Tested-by: Jenkins Reviewed-by: Mike Kaganski Reviewed-by: Julien Nabet --- dtrans/source/win32/clipb/MtaOleClipb.cxx | 6 +++--- dtrans/source/win32/workbench/test_wincb.cxx | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) (limited to 'dtrans/source') diff --git a/dtrans/source/win32/clipb/MtaOleClipb.cxx b/dtrans/source/win32/clipb/MtaOleClipb.cxx index de966c3978c3..2fdc2d7f9641 100644 --- a/dtrans/source/win32/clipb/MtaOleClipb.cxx +++ b/dtrans/source/win32/clipb/MtaOleClipb.cxx @@ -179,14 +179,14 @@ class CAutoComInit { public: /* - to be safe we call CoInitialize + to be safe we call CoInitializeEx although it is not necessary if the calling thread was created using osl_CreateThread because - this function calls CoInitialize + this function calls CoInitializeEx for every thread it creates */ - CAutoComInit( ) : m_hResult( CoInitialize( nullptr ) ) + CAutoComInit( ) : m_hResult( CoInitializeEx( nullptr, COINIT_APARTMENTTHREADED ) ) { if ( S_OK == m_hResult ) OSL_FAIL( diff --git a/dtrans/source/win32/workbench/test_wincb.cxx b/dtrans/source/win32/workbench/test_wincb.cxx index 8a2f25fd4ccc..96839e22a49a 100644 --- a/dtrans/source/win32/workbench/test_wincb.cxx +++ b/dtrans/source/win32/workbench/test_wincb.cxx @@ -206,7 +206,7 @@ int SAL_CALL main( int nArgc, char* Argv[] ) // threaded apartment we need a message loop to deliver // messages to our XTDataObject //HRESULT hr = CoInitializeEx( NULL, COINIT_MULTITHREADED ); - (void)CoInitialize( NULL ); + (void)CoInitializeEx( NULL, COINIT_APARTMENTTHREADED ); char buff[6]; -- cgit