unotools/source/config/moduleoptions.cxx | 25 +++++++++++++------------ 1 file changed, 13 insertions(+), 12 deletions(-)
New commits: commit fd4acfaca9fc012313f03f46e927add6feb6a553 Author: Noel Grandin <noelgran...@gmail.com> AuthorDate: Thu Dec 23 19:37:42 2021 +0200 Commit: Noel Grandin <noel.gran...@collabora.co.uk> CommitDate: Fri Dec 24 20:19:22 2021 +0100 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.gran...@collabora.co.uk> 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(); }