diff options
author | Eike Rathke <erack@redhat.com> | 2017-04-11 20:58:34 +0200 |
---|---|---|
committer | Eike Rathke <erack@redhat.com> | 2017-04-13 00:48:47 +0200 |
commit | 2780f44627e487761c1f37f6475239bca6a262e0 (patch) | |
tree | 2ca47a6a81a07a472cb9de0c5ac199a8296f838c /sc | |
parent | 57bdeafc092ae75b8b4c0fb0e5ec4660d96e3de8 (diff) |
in RemoveCaption() forget() instead of reset(nullptr)
Change-Id: Id97d4d97c1d46ac6de6198515756a0786a54626e
Diffstat (limited to 'sc')
-rw-r--r-- | sc/source/core/data/postit.cxx | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/sc/source/core/data/postit.cxx b/sc/source/core/data/postit.cxx index e8afbb2479dc..7d3effc671fd 100644 --- a/sc/source/core/data/postit.cxx +++ b/sc/source/core/data/postit.cxx @@ -1130,6 +1130,7 @@ void ScPostIt::RemoveCaption() ScDrawLayer* pDrawLayer = mrDoc.GetDrawLayer(); if (maNoteData.mxCaption && (pDrawLayer == maNoteData.mxCaption->GetModel())) maNoteData.mxCaption.removeFromDrawPageAndFree(); + // Either the caption object is gone or, because of Undo or clipboard is // held in at least two instances, or only one instance in Undo because the // original sheet in this document is just deleted, or the Undo document is @@ -1137,7 +1138,11 @@ void ScPostIt::RemoveCaption() // Let's detect other use cases.. assert(!maNoteData.mxCaption || maNoteData.mxCaption.getRefs() >= 2 || (!mrDoc.IsUndo() && !mrDoc.IsClipboard()) || (mrDoc.IsUndo() && mrDoc.IsInDtorClear())); - maNoteData.mxCaption.reset(nullptr); + + // Forget the caption object if removeFromDrawPageAndFree() above did not + // free it. + if (maNoteData.mxCaption) + maNoteData.mxCaption.forget(); } ScCaptionPtr ScNoteUtil::CreateTempCaption( |