diff options
author | Eike Rathke <erack@redhat.com> | 2017-01-18 16:18:38 +0100 |
---|---|---|
committer | Christian Lohmaier <lohmaier+LibreOffice@googlemail.com> | 2017-01-26 22:16:27 +0000 |
commit | 3097bdd13ab3b1a0e16da862cb46614025bce504 (patch) | |
tree | c45deca9169c620aee968f049f1d00e845d7135a | |
parent | update credits (diff) | |
download | core-3097bdd13ab3b1a0e16da862cb46614025bce504.tar.gz core-3097bdd13ab3b1a0e16da862cb46614025bce504.zip |
tdf#104967 prevent crash when pasting notes originating from a closed document
This is only a workaround to prevent a crash, the actual note content is lost
when pasting, only a standard empty note caption will be pasted.
Change-Id: Ifaef5d30cc2024f3d03d6b2b4f56c5ccfbb67142
(cherry picked from commit cb566c056b0e8f9f73dac3cbaf497e102a247cb9)
Reviewed-on: https://gerrit.libreoffice.org/33275
Reviewed-by: Markus Mohrhard <markus.mohrhard@googlemail.com>
Reviewed-by: Michael Stahl <mstahl@redhat.com>
Reviewed-by: Christian Lohmaier <lohmaier+LibreOffice@googlemail.com>
Tested-by: Christian Lohmaier <lohmaier+LibreOffice@googlemail.com>
-rw-r--r-- | sc/source/core/data/documen2.cxx | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/sc/source/core/data/documen2.cxx b/sc/source/core/data/documen2.cxx index 766aa9f0fe12..f884bcdd0b0e 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. |