summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLászló Németh <nemeth@numbertext.org>2021-10-13 08:56:02 +0200
committerMichael Stahl <michael.stahl@allotropia.de>2021-12-17 11:20:22 +0100
commita91ab152a8ca911b7f75723a59a402bac6d9b05b (patch)
treedd38ba27c3f2045b1ea68fa79175333da7ec904a
parenttdf#145381 handle closing brackets in URLs correctly (diff)
downloadcore-a91ab152a8ca911b7f75723a59a402bac6d9b05b.tar.gz
core-a91ab152a8ca911b7f75723a59a402bac6d9b05b.zip
tdf#145093 sw track changes: fix crash at moving list items
over a tracked paragraph insertion (both in Show Changes and Hide Changes modes). Note: we needed a Python UI test, because uiwriter doesn't crash on Linux without this fix. Likely regression from commit a19dc0d9cc35ae1e200f51d86950595f6771e9c3 "sw_redlinehide_3: update frames in MoveParagraph()". Reviewed-on: https://gerrit.libreoffice.org/c/core/+/123551 Tested-by: László Németh <nemeth@numbertext.org> Reviewed-by: László Németh <nemeth@numbertext.org> (cherry picked from commit eda5ac4a63fac6bce939b6791dec52270618dc29) Change-Id: I3026c9136e2fa6dcc1f6b5bad1677846a6cfe614 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/126951 Tested-by: Michael Stahl <michael.stahl@allotropia.de> Reviewed-by: Michael Stahl <michael.stahl@allotropia.de>
-rw-r--r--sw/qa/uitest/data/tdf39721.fodt42
-rw-r--r--sw/qa/uitest/writer_tests7/tdf145093.py34
-rw-r--r--sw/source/core/doc/DocumentContentOperationsManager.cxx6
3 files changed, 80 insertions, 2 deletions
diff --git a/sw/qa/uitest/data/tdf39721.fodt b/sw/qa/uitest/data/tdf39721.fodt
new file mode 100644
index 000000000000..1acf06c5e2a5
--- /dev/null
+++ b/sw/qa/uitest/data/tdf39721.fodt
@@ -0,0 +1,42 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<office:document xmlns:office="urn:oasis:names:tc:opendocument:xmlns:office:1.0" xmlns:style="urn:oasis:names:tc:opendocument:xmlns:style:1.0" xmlns:text="urn:oasis:names:tc:opendocument:xmlns:text:1.0" xmlns:fo="urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0" xmlns:officeooo="http://openoffice.org/2009/office" office:version="1.2" office:mimetype="application/vnd.oasis.opendocument.text" xmlns:dc="http://purl.org/dc/elements/1.1/">
+ <office:styles>
+ <style:style style:name="Standard" style:family="paragraph" style:class="text"/>
+ <style:default-style style:family="paragraph">
+ <style:text-properties fo:language="en" fo:country="US"/>
+ </style:default-style>
+ </office:styles>
+ <office:body>
+ <office:text>
+ <text:tracked-changes text:track-changes="false">
+ <text:changed-region xml:id="ct94454449144064" text:id="ct94454449144064">
+ <text:deletion>
+ <office:change-info>
+ <dc:creator>Unknown Author</dc:creator>
+ <dc:date>2021-01-06T16:18:57</dc:date>
+ </office:change-info>
+ </text:deletion>
+ </text:changed-region>
+ <text:changed-region xml:id="ct94454455394000" text:id="ct94454455394000">
+ <text:deletion>
+ <office:change-info>
+ <dc:creator>Unknown Author</dc:creator>
+ <dc:date>2021-01-06T16:20:17</dc:date>
+ </office:change-info>
+ </text:deletion>
+ </text:changed-region>
+ </text:tracked-changes>
+ <text:list xml:id="list627175737" text:style-name="L3">
+ <text:list-item>
+ <text:p text:style-name="P1">Lorem<text:change-start text:change-id="ct94454449144064"/> ipsu<text:change-end text:change-id="ct94454449144064"/>m</text:p>
+ </text:list-item>
+ <text:list-item>
+ <text:p text:style-name="P1">dol<text:change-start text:change-id="ct94454455394000"/>or <text:change-end text:change-id="ct94454455394000"/>sit</text:p>
+ </text:list-item>
+ <text:list-item>
+ <text:p text:style-name="P1">amet.</text:p>
+ </text:list-item>
+ </text:list>
+ </office:text>
+ </office:body>
+</office:document>
diff --git a/sw/qa/uitest/writer_tests7/tdf145093.py b/sw/qa/uitest/writer_tests7/tdf145093.py
new file mode 100644
index 000000000000..c22510a619cc
--- /dev/null
+++ b/sw/qa/uitest/writer_tests7/tdf145093.py
@@ -0,0 +1,34 @@
+# -*- tab-width: 4; indent-tabs-mode: nil; py-indent-offset: 4 -*-
+#
+# This Source Code Form is subject to the terms of the Mozilla Public
+# License, v. 2.0. If a copy of the MPL was not distributed with this
+# file, You can obtain one at http://mozilla.org/MPL/2.0/.
+#
+from uitest.framework import UITestCase
+from libreoffice.uno.propertyvalue import mkPropertyValues
+from uitest.uihelper.common import select_pos
+from uitest.uihelper.common import type_text
+from uitest.uihelper.common import get_url_for_data_file
+
+class tdf145093(UITestCase):
+ def test_tdf145093(self):
+ # load the sample file
+ with self.ui_test.load_file(get_url_for_data_file("tdf39721.fodt")) as document:
+
+ # redlining should be on
+ self.xUITest.executeCommand(".uno:TrackChanges")
+
+ # Move Up/Down a list item over a tracked paragraph insertion resulted a crash
+ # (Note: not only at the end of the document, but check the original
+ # bug report temporarily, where the problem is triggered by an other problem).
+
+ self.xUITest.executeCommand(".uno:MoveDown")
+ self.xUITest.executeCommand(".uno:MoveDown")
+ # Note: Move list item from the end of the document creates an extra insertion.
+ # TODO: fix this other problem, and improve the test with an extra paragraph insertion
+ self.xUITest.executeCommand(".uno:MoveUp")
+
+ # This was a crash (using invalid pointer) both in Show Changes and Hide Changes modes
+ self.xUITest.executeCommand(".uno:MoveDown")
+
+# vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/sw/source/core/doc/DocumentContentOperationsManager.cxx b/sw/source/core/doc/DocumentContentOperationsManager.cxx
index 0199260aa6cf..5afadfff3de8 100644
--- a/sw/source/core/doc/DocumentContentOperationsManager.cxx
+++ b/sw/source/core/doc/DocumentContentOperationsManager.cxx
@@ -935,8 +935,10 @@ namespace
for(SaveRedline & rSvRedLine : rArr)
{
rSvRedLine.SetPos( nInsPos );
- pDoc->getIDocumentRedlineAccess().AppendRedline( rSvRedLine.pRedl, true );
- if (rSvRedLine.pRedl->GetType() == RedlineType::Delete)
+ IDocumentRedlineAccess::AppendResult const result(
+ pDoc->getIDocumentRedlineAccess().AppendRedline( rSvRedLine.pRedl, true ));
+ if ( IDocumentRedlineAccess::AppendResult::APPENDED == result &&
+ rSvRedLine.pRedl->GetType() == RedlineType::Delete )
{
UpdateFramesForAddDeleteRedline(*pDoc, *rSvRedLine.pRedl);
}