summaryrefslogtreecommitdiff
path: root/vcl/win/app/fileregistration.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'vcl/win/app/fileregistration.cxx')
-rw-r--r--vcl/win/app/fileregistration.cxx14
1 files changed, 3 insertions, 11 deletions
diff --git a/vcl/win/app/fileregistration.cxx b/vcl/win/app/fileregistration.cxx
index 2347e46c4b61..75bb0010ba21 100644
--- a/vcl/win/app/fileregistration.cxx
+++ b/vcl/win/app/fileregistration.cxx
@@ -112,14 +112,9 @@ static bool IsDefaultAppInstalledInReg()
void LaunchRegistrationUI()
{
- const bool bUninit = SUCCEEDED(CoInitializeEx(nullptr, COINIT_APARTMENTTHREADED));
- comphelper::ScopeGuard g([bUninit]() {
- if (bUninit)
- CoUninitialize();
- });
-
try
{
+ sal::systools::CoInitializeGuard aGuard(COINIT_APARTMENTTHREADED);
if (IsWindows10OrGreater())
{
LaunchModernSettingsDialogDefaultApps();
@@ -150,11 +145,8 @@ void CheckFileExtRegistration(weld::Window* pDialogParent)
if (!IsDefaultAppInstalledInReg())
return;
- const bool bUninit = SUCCEEDED(CoInitializeEx(nullptr, COINIT_APARTMENTTHREADED));
- comphelper::ScopeGuard g([bUninit]() {
- if (bUninit)
- CoUninitialize();
- });
+ sal::systools::CoInitializeGuard aGuard(COINIT_APARTMENTTHREADED, false,
+ sal::systools::CoInitializeGuard::WhenFailed::NoThrow);
sal::systools::COMReference<IApplicationAssociationRegistration> pAAR;
try
{