summaryrefslogtreecommitdiff
path: root/unotools
diff options
context:
space:
mode:
authorNoel Grandin <noelgrandin@gmail.com>2021-12-23 19:37:42 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2021-12-24 20:19:22 +0100
commitfd4acfaca9fc012313f03f46e927add6feb6a553 (patch)
tree0ba39a44a7ae71f62c98debac7109949a52dc303 /unotools
parentaddd00fefe246e3045380e97e9a66a39a23ecb4a (diff)
osl::Mutex->std::mutex in SvtModuleOptions
Change-Id: I6882b30c823d06aa04c04c8a17bfe33cc45d7307 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/127415 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'unotools')
-rw-r--r--unotools/source/config/moduleoptions.cxx25
1 files changed, 13 insertions, 12 deletions
diff --git a/unotools/source/config/moduleoptions.cxx b/unotools/source/config/moduleoptions.cxx
index 324736359b6e..967191c06e1f 100644
--- a/unotools/source/config/moduleoptions.cxx
+++ b/unotools/source/config/moduleoptions.cxx
@@ -762,9 +762,9 @@ namespace {
//global
std::weak_ptr<SvtModuleOptions_Impl> g_pModuleOptions;
-osl::Mutex& impl_GetOwnStaticMutex()
+std::mutex& impl_GetOwnStaticMutex()
{
- static osl::Mutex s_Mutex;
+ static std::mutex s_Mutex;
return s_Mutex;
}
}
@@ -785,13 +785,14 @@ SvtModuleOptions::SvtModuleOptions()
return;
// take the mutex, so we don't accidentally create more than one
- ::osl::MutexGuard aGuard( impl_GetOwnStaticMutex() );
+ std::unique_lock aGuard( impl_GetOwnStaticMutex() );
m_pImpl = g_pModuleOptions.lock();
if( !m_pImpl )
{
m_pImpl = std::make_shared<SvtModuleOptions_Impl>();
g_pModuleOptions = m_pImpl;
+ aGuard.unlock(); // because holdConfigItem will call this constructor
ItemHolder1::holdConfigItem(EItem::ModuleOptions);
}
}
@@ -823,32 +824,32 @@ const OUString & SvtModuleOptions::GetFactoryName( EFactory eFactory ) const
OUString SvtModuleOptions::GetFactoryStandardTemplate( EFactory eFactory ) const
{
- ::osl::MutexGuard aGuard( impl_GetOwnStaticMutex() );
+ std::unique_lock aGuard( impl_GetOwnStaticMutex() );
return m_pImpl->GetFactoryStandardTemplate( eFactory );
}
OUString SvtModuleOptions::GetFactoryEmptyDocumentURL( EFactory eFactory ) const
{
- ::osl::MutexGuard aGuard( impl_GetOwnStaticMutex() );
+ std::unique_lock aGuard( impl_GetOwnStaticMutex() );
return SvtModuleOptions_Impl::GetFactoryEmptyDocumentURL( eFactory );
}
OUString SvtModuleOptions::GetFactoryDefaultFilter( EFactory eFactory ) const
{
- ::osl::MutexGuard aGuard( impl_GetOwnStaticMutex() );
+ std::unique_lock aGuard( impl_GetOwnStaticMutex() );
return m_pImpl->GetFactoryDefaultFilter( eFactory );
}
bool SvtModuleOptions::IsDefaultFilterReadonly( EFactory eFactory ) const
{
- ::osl::MutexGuard aGuard( impl_GetOwnStaticMutex() );
+ std::unique_lock aGuard( impl_GetOwnStaticMutex() );
m_pImpl->MakeReadonlyStatesAvailable();
return m_pImpl->IsDefaultFilterReadonly( eFactory );
}
sal_Int32 SvtModuleOptions::GetFactoryIcon( EFactory eFactory ) const
{
- ::osl::MutexGuard aGuard( impl_GetOwnStaticMutex() );
+ std::unique_lock aGuard( impl_GetOwnStaticMutex() );
return m_pImpl->GetFactoryIcon( eFactory );
}
@@ -862,14 +863,14 @@ bool SvtModuleOptions::ClassifyFactoryByName( std::u16string_view sName ,
void SvtModuleOptions::SetFactoryStandardTemplate( EFactory eFactory ,
const OUString& sTemplate )
{
- ::osl::MutexGuard aGuard( impl_GetOwnStaticMutex() );
+ std::unique_lock aGuard( impl_GetOwnStaticMutex() );
m_pImpl->SetFactoryStandardTemplate( eFactory, sTemplate );
}
void SvtModuleOptions::SetFactoryDefaultFilter( EFactory eFactory,
const OUString& sFilter )
{
- ::osl::MutexGuard aGuard( impl_GetOwnStaticMutex() );
+ std::unique_lock aGuard( impl_GetOwnStaticMutex() );
m_pImpl->SetFactoryDefaultFilter( eFactory, sFilter );
}
@@ -899,7 +900,7 @@ bool SvtModuleOptions::IsDraw() const
bool SvtModuleOptions::IsWriter() const
{
- ::osl::MutexGuard aGuard( impl_GetOwnStaticMutex() );
+ std::unique_lock aGuard( impl_GetOwnStaticMutex() );
return m_pImpl->IsModuleInstalled( EModule::WRITER );
}
@@ -1086,7 +1087,7 @@ SvtModuleOptions::EFactory SvtModuleOptions::ClassifyFactoryByModel(const css::u
css::uno::Sequence < OUString > SvtModuleOptions::GetAllServiceNames()
{
- ::osl::MutexGuard aGuard( impl_GetOwnStaticMutex() );
+ std::unique_lock aGuard( impl_GetOwnStaticMutex() );
return m_pImpl->GetAllServiceNames();
}