summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--sc/source/core/data/documen2.cxx15
1 files changed, 15 insertions, 0 deletions
diff --git a/sc/source/core/data/documen2.cxx b/sc/source/core/data/documen2.cxx
index b5d60abd7136..cd3f2d715362 100644
--- a/sc/source/core/data/documen2.cxx
+++ b/sc/source/core/data/documen2.cxx
@@ -373,6 +373,21 @@ ScDocument::~ScDocument()
pRefreshTimerControl = nullptr;
}
+ if (IsClipboardSource())
+ {
+ // Notes copied to the clipboard have a raw SdrCaptionObj pointer
+ // copied from this document, forget it as it references this
+ // document's drawing layer pages and what not, which otherwise when
+ // pasting to another document after this document was destructed would
+ // attempt to access non-existing data.
+ /* XXX this is only a workaround to prevent a crash, the actual note
+ * content is lost, only a standard empty note caption will be pasted.
+ * TODO: come up with a solution. */
+ ScDocument* pClipDoc = ScModule::GetClipDoc();
+ if (pClipDoc)
+ pClipDoc->ForgetNoteCaptions( ScRangeList( ScRange( 0,0,0, MAXCOL, MAXROW, pClipDoc->GetTableCount()-1)));
+ }
+
mxFormulaParserPool.reset();
// Destroy the external ref mgr instance here because it has a timer
// which needs to be stopped before the app closes.