diff options
Diffstat (limited to 'unotools')
-rw-r--r-- | unotools/source/config/historyoptions.cxx | 26 | ||||
-rw-r--r-- | unotools/source/config/moduleoptions.cxx | 20 | ||||
-rw-r--r-- | unotools/source/ucbhelper/tempfile.cxx | 26 |
3 files changed, 36 insertions, 36 deletions
diff --git a/unotools/source/config/historyoptions.cxx b/unotools/source/config/historyoptions.cxx index 62de1e70d1c4..c317aff79918 100644 --- a/unotools/source/config/historyoptions.cxx +++ b/unotools/source/config/historyoptions.cxx @@ -396,21 +396,21 @@ static void TruncateList( xList->getByName(s_sItemList) >>= xItemList; const sal_uInt32 nLength = xOrderList->getElementNames().getLength(); - if (nSize < nLength) - { - for (sal_uInt32 i=nLength-1; i>=nSize; --i) - { - uno::Reference<beans::XPropertySet> xSet; - OUString sTmp; - const OUString sRemove = OUString::number(i); - xOrderList->getByName(sRemove) >>= xSet; - xSet->getPropertyValue(s_sHistoryItemRef) >>= sTmp; - xItemList->removeByName(sTmp); - xOrderList->removeByName(sRemove); - } + if (nSize >= nLength) + return; - ::comphelper::ConfigurationHelper::flush(xCfg); + for (sal_uInt32 i=nLength-1; i>=nSize; --i) + { + uno::Reference<beans::XPropertySet> xSet; + OUString sTmp; + const OUString sRemove = OUString::number(i); + xOrderList->getByName(sRemove) >>= xSet; + xSet->getPropertyValue(s_sHistoryItemRef) >>= sTmp; + xItemList->removeByName(sTmp); + xOrderList->removeByName(sRemove); } + + ::comphelper::ConfigurationHelper::flush(xCfg); } diff --git a/unotools/source/config/moduleoptions.cxx b/unotools/source/config/moduleoptions.cxx index 35018b8b88c7..e73165ff4b18 100644 --- a/unotools/source/config/moduleoptions.cxx +++ b/unotools/source/config/moduleoptions.cxx @@ -781,18 +781,18 @@ SvtModuleOptions::SvtModuleOptions() { // no need to take the mutex yet, shared_ptr/weak_ptr are thread-safe m_pImpl = g_pModuleOptions.lock(); + if( m_pImpl ) + return; + + // take the mutex, so we don't accidentally create more than one + ::osl::MutexGuard aGuard( impl_GetOwnStaticMutex() ); + + m_pImpl = g_pModuleOptions.lock(); if( !m_pImpl ) { - // take the mutex, so we don't accidentally create more than one - ::osl::MutexGuard aGuard( impl_GetOwnStaticMutex() ); - - m_pImpl = g_pModuleOptions.lock(); - if( !m_pImpl ) - { - m_pImpl = std::make_shared<SvtModuleOptions_Impl>(); - g_pModuleOptions = m_pImpl; - ItemHolder1::holdConfigItem(EItem::ModuleOptions); - } + m_pImpl = std::make_shared<SvtModuleOptions_Impl>(); + g_pModuleOptions = m_pImpl; + ItemHolder1::holdConfigItem(EItem::ModuleOptions); } } diff --git a/unotools/source/ucbhelper/tempfile.cxx b/unotools/source/ucbhelper/tempfile.cxx index b53a56c60c02..22ce434b0e3e 100644 --- a/unotools/source/ucbhelper/tempfile.cxx +++ b/unotools/source/ucbhelper/tempfile.cxx @@ -385,20 +385,20 @@ TempFile::TempFile(TempFile && other) noexcept : TempFile::~TempFile() { - if ( bKillingFileEnabled ) + if ( !bKillingFileEnabled ) + return; + + // if we're going to delete this file, no point in flushing it when closing + if (pStream && !aName.isEmpty()) + static_cast<SvFileStream*>(pStream.get())->SetDontFlushOnClose(true); + pStream.reset(); + if ( bIsDirectory ) { - // if we're going to delete this file, no point in flushing it when closing - if (pStream && !aName.isEmpty()) - static_cast<SvFileStream*>(pStream.get())->SetDontFlushOnClose(true); - pStream.reset(); - if ( bIsDirectory ) - { - comphelper::DirectoryHelper::deleteDirRecursively(aName); - } - else - { - File::remove( aName ); - } + comphelper::DirectoryHelper::deleteDirRecursively(aName); + } + else + { + File::remove( aName ); } } |