framework/source/accelerators/storageholder.cxx |   14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)

New commits:
commit 2d7fa2ba4e4f7139232cf9778d352c2215cb4d50
Author:     Caolán McNamara <caolan.mcnam...@collabora.com>
AuthorDate: Tue Aug 12 10:45:23 2025 +0100
Commit:     Caolán McNamara <caolan.mcnam...@collabora.com>
CommitDate: Tue Aug 12 15:42:34 2025 +0200

    rework StorageHolder::openPath a little
    
    convince myself that cid#1660530 Data race condition is bogus
    
    Change-Id: I02a7ad95d7649757aa073f3a7c45144e60d177d5
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/189412
    Tested-by: Jenkins
    Reviewed-by: Caolán McNamara <caolan.mcnam...@collabora.com>

diff --git a/framework/source/accelerators/storageholder.cxx 
b/framework/source/accelerators/storageholder.cxx
index 95937439ca61..4dfda35efadb 100644
--- a/framework/source/accelerators/storageholder.cxx
+++ b/framework/source/accelerators/storageholder.cxx
@@ -95,12 +95,11 @@ css::uno::Reference< css::embed::XStorage > 
StorageHolder::openPath(const OUStri
         // If we found an already open storage ... we must increase
         // its use count. Otherwise it will may be closed too early :-)
         TPath2StorageInfo::iterator pCheck = m_lStorages.find(sCheckPath);
-        TStorageInfo*               pInfo  = nullptr;
         if (pCheck != m_lStorages.end())
         {
-            pInfo = &(pCheck->second);
-            ++(pInfo->UseCount);
-            xChild = pInfo->Storage;
+            TStorageInfo& rInfo = pCheck->second;
+            ++rInfo.UseCount;
+            xChild = rInfo.Storage;
 
             aReadLock.unlock();
             // <- SAFE ------------------------------
@@ -132,9 +131,10 @@ css::uno::Reference< css::embed::XStorage > 
StorageHolder::openPath(const OUStri
                 }
 
             std::unique_lock g(m_mutex);
-            pInfo = &(m_lStorages[sCheckPath]);
-            pInfo->Storage  = xChild;
-            pInfo->UseCount = 1;
+            TStorageInfo aInfo;
+            aInfo.Storage  = xChild;
+            aInfo.UseCount = 1;
+            m_lStorages.emplace(sCheckPath, std::move(aInfo));
         }
 
         xParent   = xChild;

Reply via email to