[Libreoffice-commits] core.git: sc/source

Eike Rathke erack at redhat.com
Tue Feb 28 16:18:16 UTC 2017


 sc/source/core/data/postit.cxx |    7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

New commits:
commit d407791075ce4caff1259aa9a8ae573e4b7bb8bd
Author: Eike Rathke <erack at redhat.com>
Date:   Tue Feb 28 17:16:33 2017 +0100

    dissolve() needs to delete head now that it's not a list element anymore
    
    Change-Id: I9949a1006e6d1b4b50dd5350106ad69b643e833c

diff --git a/sc/source/core/data/postit.cxx b/sc/source/core/data/postit.cxx
index b0e736b..2e084c6 100644
--- a/sc/source/core/data/postit.cxx
+++ b/sc/source/core/data/postit.cxx
@@ -665,15 +665,18 @@ bool ScCaptionPtr::forget()
 
 void ScCaptionPtr::dissolve()
 {
+    ScCaptionPtr::Head* pHead = mpHead;
     ScCaptionPtr* pThat = (mpHead ? mpHead->mpFirst : this);
     while (pThat)
     {
-        assert(!pThat->mpNext || mpHead);   // next without head is bad
+        assert(!pThat->mpNext || pThat->mpHead);    // next without head is bad
+        assert(pThat->mpHead == pHead);             // same head required within one list
         ScCaptionPtr* p = pThat->mpNext;
         pThat->clear();
         pThat = p;
     }
-    clear();
+    assert(!mpHead && !mpNext && !mpCaption);       // should had been cleared during list walk
+    delete pHead;
 }
 
 void ScCaptionPtr::clear()


More information about the Libreoffice-commits mailing list