summaryrefslogtreecommitdiff
path: root/sc
diff options
context:
space:
mode:
authorEike Rathke <erack@redhat.com>2017-02-28 18:28:53 +0100
committerEike Rathke <erack@redhat.com>2017-02-28 18:31:02 +0100
commitd3676ceeec55a41337ce5e6bc596f4f100d0638e (patch)
tree070b39394ee51f411d00fe3028f7852d07231320 /sc
parente6a90b3f28d948275188e7504fc9d46f0793e36f (diff)
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
Diffstat (limited to 'sc')
-rw-r--r--sc/source/core/data/postit.cxx13
1 files changed, 5 insertions, 8 deletions
diff --git a/sc/source/core/data/postit.cxx b/sc/source/core/data/postit.cxx
index 2e084c6b8e33..965d843aafc1 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;
}
}