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
diff --git a/sc/source/core/data/postit.cxx b/sc/source/core/data/postit.cxx
index 67efdf2..02502ed 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;
}