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

New commits:
commit f8ef0f78ed1432659cc0537a0ebb85abe9211369
Author:     Caolán McNamara <caol...@redhat.com>
AuthorDate: Wed Sep 7 16:33:16 2022 +0100
Commit:     Caolán McNamara <caol...@redhat.com>
CommitDate: Wed Sep 7 22:17:40 2022 +0200

    cid#1509288 rearrange to make clearer what actually happens
    
    similar to
    
    commit ce36d36233053cea8b5db7f39f2693726a43940a
    Author: Caolán McNamara <caol...@redhat.com>
    Date:   Tue Sep 6 14:25:09 2022 +0100
    
        cid#1500385 rearrange to make clearer what actually happens
    
    Change-Id: I559dab7b8570662644f6b4dac392c307bdef9a84
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/139603
    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 bda0ac8b06e9..124089bd7139 100644
--- a/sc/source/core/data/documen2.cxx
+++ b/sc/source/core/data/documen2.cxx
@@ -1259,10 +1259,10 @@ void ScDocument::RemoveSortedRangeCache( 
ScSortedRangeCache & rCache )
     auto it(mxScSortedRangeCache->aCacheMap.find(rCache.getHashKey()));
     if (it != mxScSortedRangeCache->aCacheMap.end())
     {
-        ScSortedRangeCache* pCache = (*it).second.release();
+        std::unique_ptr<ScSortedRangeCache> xCache = std::move(it->second);
         mxScSortedRangeCache->aCacheMap.erase(it);
         assert(!IsThreadedGroupCalcInProgress()); // EndListeningArea() is not 
thread-safe
-        EndListeningArea(pCache->getRange(), false, &rCache);
+        EndListeningArea(xCache->getRange(), false, &rCache);
         return;
     }
     OSL_FAIL( "ScDocument::RemoveSortedRangeCache: range not found in hash 
map");
diff --git a/sc/source/core/tool/rangecache.cxx 
b/sc/source/core/tool/rangecache.cxx
index a96db0f0be03..f42d36843619 100644
--- a/sc/source/core/tool/rangecache.cxx
+++ b/sc/source/core/tool/rangecache.cxx
@@ -180,7 +180,7 @@ void ScSortedRangeCache::Notify(const SfxHint& rHint)
         if (rHint.GetId() == SfxHintId::ScDataChanged || rHint.GetId() == 
SfxHintId::ScAreaChanged)
         {
             mpDoc->RemoveSortedRangeCache(*this);
-            delete this;
+            // this ScSortedRangeCache is deleted by RemoveSortedRangeCache
         }
     }
 }

Reply via email to