summaryrefslogtreecommitdiff
path: root/sw/source
diff options
context:
space:
mode:
authorMichael Stahl <mstahl@redhat.com>2018-02-14 12:57:49 +0100
committerMichael Stahl <mstahl@redhat.com>2018-02-15 09:56:55 +0100
commit1c8efde4daea648204e3ba19f8edc01ef3e548bd (patch)
treed46e889b698005a142a08bfe873162fd6e877cce /sw/source
parentaac475436271ddeabf6d9a4c3984ba77accf56ce (diff)
tdf#83260 sw: call CompressRedlines() in ODF import
It's possible that an ODF document contains redlines that will be deduplicated by CompressRedlines(). If that happens during some editing operation, then a SwRedline will be deleted and the nodes array becomes smaller by at least 3 nodes; any Undo actions that were created prior to the operation that called CompressRedlines() will store invalid node indexes now and Undo will crash. So presumably it's a precondition of editing operations that CompressRedlines() is a no-op. Interestingly CompressRedlines() is also called from SwEditShell::Undo()/Redo(). Ensure it's a no-op later by calling CompressRedlines() immediately after load. (Hopefully this should also work for the Insert File case.) Add a test too. Change-Id: Iec8135cc60260ed5cfff05a196b5c92cc03265f9 Reviewed-on: https://gerrit.libreoffice.org/49721 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Michael Stahl <mstahl@redhat.com>
Diffstat (limited to 'sw/source')
-rw-r--r--sw/source/filter/xml/swxml.cxx5
1 files changed, 5 insertions, 0 deletions
diff --git a/sw/source/filter/xml/swxml.cxx b/sw/source/filter/xml/swxml.cxx
index 700bad46ba96..a96433fa042e 100644
--- a/sw/source/filter/xml/swxml.cxx
+++ b/sw/source/filter/xml/swxml.cxx
@@ -885,6 +885,11 @@ ErrCode XMLReader::Read( SwDoc &rDoc, const OUString& rBaseURL, SwPaM &rPaM, con
// (First set bogus mode to make sure the mode in getIDocumentRedlineAccess().SetRedlineFlags()
// is different from its previous mode.)
rDoc.getIDocumentRedlineAccess().SetRedlineFlags_intern( ~nRedlineFlags );
+ // must set flags to show delete so that CompressRedlines works
+ rDoc.getIDocumentRedlineAccess().SetRedlineFlags(nRedlineFlags|RedlineFlags::ShowDelete);
+ // tdf#83260 ensure that the first call of CompressRedlines after loading
+ // the document is a no-op by calling it now
+ rDoc.getIDocumentRedlineAccess().CompressRedlines();
rDoc.getIDocumentRedlineAccess().SetRedlineFlags( nRedlineFlags );
lcl_EnsureValidPam( rPaM ); // move Pam into valid content