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

Eike Rathke erack at redhat.com
Tue Feb 28 17:31:35 UTC 2017


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

New commits:
commit d3676ceeec55a41337ce5e6bc596f4f100d0638e
Author: Eike Rathke <erack at redhat.com>
Date:   Tue Feb 28 18:28:53 2017 +0100

    in decRefAndDestroy() the remaining element must be one and only one
    
    So head can be destroyed already there and removeFromList() take a short cut.
    
    Change-Id: I8f53d252c4e0ad867674ee410ecfaa300ac0c731

diff --git a/sc/source/core/data/postit.cxx b/sc/source/core/data/postit.cxx
index 2e084c6..965d843 100644
--- a/sc/source/core/data/postit.cxx
+++ b/sc/source/core/data/postit.cxx
@@ -637,14 +637,11 @@ void ScCaptionPtr::decRefAndDestroy()
          * foo and call SdrObject::Free(), likely with mpHead->mpCaption, see
          * ScPostIt::RemoveCaption(). Further work needed to be able to do so.
          * */
-        ScCaptionPtr* pThat = (mpHead ? mpHead->mpFirst : this);
-        do
-        {
-            pThat->mpCaption = nullptr;
-            pThat = pThat->mpNext;
-        }
-        while (pThat);
-        assert(!mpCaption);     // this ought to be in list and nulled
+        assert(mpHead->mpFirst == this);    // this must be one and only one
+        mpCaption = nullptr;
+        assert(!mpNext);                    // this must be one and only one
+        delete mpHead;
+        mpHead = nullptr;
     }
 }
 


More information about the Libreoffice-commits mailing list