summaryrefslogtreecommitdiff
path: root/sal
diff options
context:
space:
mode:
authorMike Kaganski <mike.kaganski@collabora.com>2021-12-21 16:19:46 +0300
committerMike Kaganski <mike.kaganski@collabora.com>2021-12-21 17:03:30 +0100
commitc35f81148fb18ba070516edcbb4d614444899235 (patch)
treea7411001321a0745f161787fcc2be978e2c94e0a /sal
parent9466e895b319fc695cc326b37ee773e14b465c0a (diff)
Use sal::systools::CoInitializeGuard and sal::systools::ThrowIfFailed
Change-Id: Ifb40e7672671df03b5ffc89905ad1e7b68451b68 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/127232 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
Diffstat (limited to 'sal')
-rw-r--r--sal/osl/w32/thread.cxx7
1 files changed, 4 insertions, 3 deletions
diff --git a/sal/osl/w32/thread.cxx b/sal/osl/w32/thread.cxx
index e269e7cbd455..a82ac2ea8a19 100644
--- a/sal/osl/w32/thread.cxx
+++ b/sal/osl/w32/thread.cxx
@@ -27,6 +27,8 @@
#include <osl/time.h>
#include <osl/interlck.h>
#include <rtl/tencinfo.h>
+#include <systools/win32/comtools.hxx>
+
#include <errno.h>
namespace {
@@ -54,14 +56,13 @@ static unsigned __stdcall oslWorkerWrapperFunction(void* pData)
osl_TThreadImpl* pThreadImpl= static_cast<osl_TThreadImpl*>(pData);
/* Initialize COM - Multi Threaded Apartment (MTA) for all threads */
- CoInitializeEx(nullptr, COINIT_MULTITHREADED); /* spawned by oslCreateThread */
+ sal::systools::CoInitializeGuard aGuard(COINIT_MULTITHREADED, false,
+ sal::systools::CoInitializeGuard::WhenFailed::NoThrow);
/* call worker-function with data */
pThreadImpl->m_WorkerFunction(pThreadImpl->m_pData);
- CoUninitialize();
-
return 0;
}