cui/source/tabpages/transfrm.cxx | 12 ++++-------- framework/source/accelerators/storageholder.cxx | 12 ++++++------ framework/source/inc/accelerators/storageholder.hxx | 14 +++++++++++++- 3 files changed, 23 insertions(+), 15 deletions(-)
New commits: commit b644eb81c7a24eac8f57457a7692ed8c58044532 Author: Caolán McNamara <[email protected]> AuthorDate: Thu Aug 21 20:08:17 2025 +0100 Commit: Caolán McNamara <[email protected]> CommitDate: Mon Sep 1 09:17:55 2025 +0200 cid#1660394 silence Division or modulo by float zero Change-Id: I26bf7ad7bfd0164d158239f73ccd7b822490a5b8 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/190446 Reviewed-by: Caolán McNamara <[email protected]> Tested-by: Jenkins diff --git a/cui/source/tabpages/transfrm.cxx b/cui/source/tabpages/transfrm.cxx index 53ed676de924..ebab1b826348 100644 --- a/cui/source/tabpages/transfrm.cxx +++ b/cui/source/tabpages/transfrm.cxx @@ -555,7 +555,6 @@ bool SvxSlantTabPage::FillItemSet(SfxItemSet* rAttrs) void SvxSlantTabPage::Reset(const SfxItemSet* rAttrs) { // if the view has selected objects, items with SfxItemState::DEFAULT need to be disabled - const SfxPoolItem* pItem; // corner radius if(!pView->IsEdgeRadiusAllowed()) @@ -565,11 +564,10 @@ void SvxSlantTabPage::Reset(const SfxItemSet* rAttrs) } else { - pItem = GetItem( *rAttrs, SDRATTR_CORNER_RADIUS ); - - if( pItem ) + const SfxPoolItem* pItem = GetItem(*rAttrs, SDRATTR_CORNER_RADIUS); + const double fUIScale(pView->GetModel().GetUIScale()); + if (pItem && fUIScale != 0.0) { - const double fUIScale(double(pView->GetModel().GetUIScale())); const double fTmp(static_cast<double>(static_cast<const SdrMetricItem*>(pItem)->GetValue()) / fUIScale); SetMetricValue(*m_xMtrRadius, basegfx::fround(fTmp), ePoolUnit); } @@ -589,9 +587,7 @@ void SvxSlantTabPage::Reset(const SfxItemSet* rAttrs) } else { - pItem = GetItem( *rAttrs, SID_ATTR_TRANSFORM_SHEAR ); - - if( pItem ) + if (const SfxPoolItem* pItem = GetItem(*rAttrs, SID_ATTR_TRANSFORM_SHEAR)) { m_xMtrAngle->set_value(static_cast<const SdrAngleItem*>(pItem)->GetValue().get(), FieldUnit::NONE); } commit a91ceefcad51743becaeb07e2da7dadac0b28f49 Author: Caolán McNamara <[email protected]> AuthorDate: Wed Aug 20 10:22:59 2025 +0100 Commit: Caolán McNamara <[email protected]> CommitDate: Mon Sep 1 09:17:48 2025 +0200 cid#1660530 silence Data race condition rejig this so coverity is satisfied Change-Id: Iad58f680b6f6fe879866c0162a88a3439af2c3f4 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/190445 Tested-by: Jenkins Reviewed-by: Caolán McNamara <[email protected]> diff --git a/framework/source/accelerators/storageholder.cxx b/framework/source/accelerators/storageholder.cxx index bf735d36d859..c2c19c3369e4 100644 --- a/framework/source/accelerators/storageholder.cxx +++ b/framework/source/accelerators/storageholder.cxx @@ -53,7 +53,7 @@ void StorageHolder::forgetCachedStorages() { TStorageInfo& rInfo = lStorage.second; // TODO think about listener ! - rInfo.Storage.clear(); + rInfo.clearStorage(g); } m_lStorages.clear(); } @@ -99,7 +99,7 @@ css::uno::Reference< css::embed::XStorage > StorageHolder::openPath(const OUStri { TStorageInfo& rInfo = pCheck->second; ++rInfo.UseCount; - xChild = rInfo.Storage; + xChild = rInfo.getStorage(aReadLock); aReadLock.unlock(); // <- SAFE ------------------------------ @@ -169,7 +169,7 @@ StorageHolder::TStorageList StorageHolder::getAllPathStorages(const OUString& sP } TStorageInfo& rInfo = pCheck->second; - lStoragesOfPath.push_back(rInfo.Storage); + lStoragesOfPath.push_back(rInfo.getStorage(g)); sRelPath += lFolder + PATH_SEPARATOR; } @@ -238,7 +238,7 @@ void StorageHolder::closePath(const OUString& rPath) --rInfo.UseCount; if (rInfo.UseCount < 1) { - rInfo.Storage.clear(); + rInfo.clearStorage(g); m_lStorages.erase(pPath); } } @@ -303,7 +303,7 @@ OUString StorageHolder::getPathOfStorage(const css::uno::Reference< css::embed:: for (auto const& lStorage : m_lStorages) { const TStorageInfo& rInfo = lStorage.second; - if (rInfo.Storage == xStorage) + if (rInfo.getStorage(g) == xStorage) return lStorage.first; } @@ -349,7 +349,7 @@ css::uno::Reference< css::embed::XStorage > StorageHolder::getParentStorage(cons auto pParent = m_lStorages.find(sParentPath.makeStringAndClear()); if (pParent != m_lStorages.end()) - return pParent->second.Storage; + return pParent->second.getStorage(aReadLock); } // <- SAFE ---------------------------------- diff --git a/framework/source/inc/accelerators/storageholder.hxx b/framework/source/inc/accelerators/storageholder.hxx index 4e4a66183dd0..7f0c420bdf1a 100644 --- a/framework/source/inc/accelerators/storageholder.hxx +++ b/framework/source/inc/accelerators/storageholder.hxx @@ -45,15 +45,27 @@ class StorageHolder final struct TStorageInfo { - public: + private: css::uno::Reference< css::embed::XStorage > Storage; + public: sal_Int32 UseCount; TStorageListenerList Listener; + public: TStorageInfo(css::uno::Reference<css::embed::XStorage> xStorage) : Storage(std::move(xStorage)) , UseCount(1) {} + + void clearStorage(const std::unique_lock<std::mutex>&) + { + Storage.clear(); + } + + css::uno::Reference<css::embed::XStorage> getStorage(const std::unique_lock<std::mutex>&) const + { + return Storage; + } }; /** @short TODO */
