sc/source/core/data/documen2.cxx    |    4 ++--
 sc/source/core/tool/lookupcache.cxx |    2 +-
 2 files changed, 3 insertions(+), 3 deletions(-)

New commits:
commit ce36d36233053cea8b5db7f39f2693726a43940a
Author:     Caolán McNamara <caol...@redhat.com>
AuthorDate: Tue Sep 6 14:25:09 2022 +0100
Commit:     Caolán McNamara <caol...@redhat.com>
CommitDate: Tue Sep 6 20:50:32 2022 +0200

    cid#1500385 rearrange to make clearer what actually happens
    
    Change-Id: Ibdd70300b5081b5ad054fed5db65fc3c8cc4c3cc
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/139523
    Tested-by: Jenkins
    Reviewed-by: Caolán McNamara <caol...@redhat.com>

diff --git a/sc/source/core/data/documen2.cxx b/sc/source/core/data/documen2.cxx
index c29025f43a37..bda0ac8b06e9 100644
--- a/sc/source/core/data/documen2.cxx
+++ b/sc/source/core/data/documen2.cxx
@@ -1241,10 +1241,10 @@ void ScDocument::RemoveLookupCache( ScLookupCache & 
rCache )
     auto it(cacheMap.aCacheMap.find(rCache.getRange()));
     if (it != cacheMap.aCacheMap.end())
     {
-        ScLookupCache* pCache = (*it).second.release();
+        std::unique_ptr<ScLookupCache> xCache = std::move(it->second);
         cacheMap.aCacheMap.erase(it);
         assert(!IsThreadedGroupCalcInProgress()); // EndListeningArea() is not 
thread-safe
-        EndListeningArea(pCache->getRange(), false, &rCache);
+        EndListeningArea(xCache->getRange(), false, &rCache);
         return;
     }
     OSL_FAIL( "ScDocument::RemoveLookupCache: range not found in hash map");
diff --git a/sc/source/core/tool/lookupcache.cxx 
b/sc/source/core/tool/lookupcache.cxx
index 487fc18970e0..70e19ec20d86 100644
--- a/sc/source/core/tool/lookupcache.cxx
+++ b/sc/source/core/tool/lookupcache.cxx
@@ -119,7 +119,7 @@ void ScLookupCache::Notify( const SfxHint& rHint )
         if (rHint.GetId() == SfxHintId::ScDataChanged || rHint.GetId() == 
SfxHintId::ScAreaChanged)
         {
             mpDoc->RemoveLookupCache( *this);
-            delete this;
+            // this ScLookupCache is deleted by RemoveLookupCache
         }
     }
 }

Reply via email to