summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEike Rathke <erack@redhat.com>2017-04-10 23:31:14 +0200
committerEike Rathke <erack@redhat.com>2017-04-10 23:31:59 +0200
commit13b70bc6f18f8dd910e373694de5a6a0cd3eb559 (patch)
tree62282984cc46e04e863faa0fea2c6b8286495295
parent8984ca204dd4753246782a4f5b8f6058bb232d33 (diff)
finally free the SdrObject in ScCaptionPtr::decRefAndDestroy()
There may be cases left still to be discovered where a setInUndo() is necessary in some Undo situations, but this is a start. Change-Id: Ic62267e3c3d24e4587343ff42da0292fbb166929
-rw-r--r--sc/source/core/data/postit.cxx22
1 files changed, 12 insertions, 10 deletions
diff --git a/sc/source/core/data/postit.cxx b/sc/source/core/data/postit.cxx
index 67efdf202648..02502ed93c84 100644
--- a/sc/source/core/data/postit.cxx
+++ b/sc/source/core/data/postit.cxx
@@ -691,18 +691,20 @@ void ScCaptionPtr::decRefAndDestroy()
assert(mpHead->mpFirst == this); // this must be one and only one
assert(!mpNext); // this must be one and only one
assert(mpCaption);
-#if 0
- if (what?)
+
+ // Destroying Draw Undo deletes its SdrObject, don't attempt that twice.
+ if (!mbInUndo)
{
- /* FIXME: this should eventually remove the caption from drawing layer
- * foo and call SdrObject::Free(), likely with mpCaption, see
- * ScPostIt::RemoveCaption(). Further work needed to be able to do so.
- * */
+ removeFromDrawPageAndFree( true ); // ignoring Undo
+ if (mpCaption)
+ {
+ // There's no draw page associated so removeFromDrawPageAndFree()
+ // didn't do anything, but still we want to delete the caption
+ // object. release()/dissolve() also resets mpCaption.
+ SdrObject* pObj = release();
+ SdrObject::Free( pObj );
+ }
}
- /* FIXME: once we got ownership right */
- //SdrObject::Free( mpCaption );
-#endif
- mpCaption = nullptr;
delete mpHead;
mpHead = nullptr;
}