summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMiklos Vajna <vmiklos@collabora.com>2021-08-05 13:43:50 +0200
committerMichael Stahl <michael.stahl@allotropia.de>2021-12-17 11:23:57 +0100
commitd9c494365e1c069a1c09a25bb06464f833f35fe8 (patch)
tree67136ab3bec0bfe7581b17780da0c598ffa30228
parenttdf#145093 sw track changes: fix crash at moving list items (diff)
downloadcore-d9c494365e1c069a1c09a25bb06464f833f35fe8.tar.gz
core-d9c494365e1c069a1c09a25bb06464f833f35fe8.zip
sw: fix assert fail with ShowRedlineChanges=false and para format
It fails like this: loolforkit: sw/source/core/layout/wsfrm.cxx:4551: void UnHide(SwRootFrame&): Assertion `rLayout.GetCurrShell()->ActionPend()' failed. #4 0x00007f98e9f8c198 in UnHide(SwRootFrame&) (rLayout=...) at sw/source/core/layout/wsfrm.cxx:4551 #5 0x00007f98e9f8c839 in SwRootFrame::SetHideRedlines(bool) (this=0x7f98c40f7bd0, bHideRedlines=false) at sw/source/core/layout/wsfrm.cxx:4664 #6 0x00007f98e9b18afd in sw::DocumentRedlineManager::SetRedlineFlags(RedlineFlags) (this=0x80a4120, eMode=49) at sw/source/core/doc/DocumentRedlineManager.cxx:1097 #7 0x00007f98e9cfa503 in SwEditShell::SetAttrSet(SfxItemSet const&, SetAttrMode, SwPaM*, bool) (this=0x8885840, rSet= SfxItemSet of pool 0x808fd10 with parent 0x0 and Which ranges: [(63, 64), (120, 120)] = {...}, nFlags=SetAttrMode::DEFAULT, pPaM=0x0, bParagraphSetting=true) at sw/source/core/edit/edatmisc.cxx:187 #8 0x00007f98ea995f07 in SwTextShell::ExecParaAttr(SfxRequest&) (this=0x8bd0820, rReq=...) at sw/source/uibase/shells/txtattr.cxx:451 Fix it the same way commit dd489bc01adc22fc5015ea56b61d66104af184a8 (tdf#125754 sw_redlinehide: avoid recursive layout in SetHideRedlines(), 2019-06-19) did: make sure that SetHideRedlines() is called before EndAllAction(). (cherry picked from commit 39392ee94c78692a9179f7face15af0c9e74e492) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/120139 Tested-by: Jenkins Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org> (cherry picked from commit 6b393b6cc65992ba6af4476024bb2f26518c388b) Change-Id: I6304abec2e2e2967a8369b0219492bebcd606d03 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/126952 Tested-by: Michael Stahl <michael.stahl@allotropia.de> Reviewed-by: Michael Stahl <michael.stahl@allotropia.de>
-rwxr-xr-xbin/find-unneeded-includes1
-rw-r--r--sw/CppunitTest_sw_core_edit.mk74
-rw-r--r--sw/Module_sw.mk1
-rw-r--r--sw/qa/core/edit/data/redline-hidden.fodt32
-rw-r--r--sw/qa/core/edit/edit.cxx57
-rw-r--r--sw/source/core/edit/edatmisc.cxx2
6 files changed, 166 insertions, 1 deletions
diff --git a/bin/find-unneeded-includes b/bin/find-unneeded-includes
index 8ba5a7d354a6..ac8c99bb46a7 100755
--- a/bin/find-unneeded-includes
+++ b/bin/find-unneeded-includes
@@ -280,6 +280,7 @@ def tidy(compileCommands, paths):
args = args.replace(assumeAbs, "-x c++ " + pathAbs)
invocation = "include-what-you-use -Xiwyu --no_fwd_decls -Xiwyu --max_line_length=200 " + args
+ print(invocation)
task_queue.put((invocation, moduleRules))
task_queue.join()
diff --git a/sw/CppunitTest_sw_core_edit.mk b/sw/CppunitTest_sw_core_edit.mk
new file mode 100644
index 000000000000..2c04606a75f9
--- /dev/null
+++ b/sw/CppunitTest_sw_core_edit.mk
@@ -0,0 +1,74 @@
+# -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*-
+#*************************************************************************
+#
+# This file is part of the LibreOffice project.
+#
+# 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/.
+#
+#*************************************************************************
+
+$(eval $(call gb_CppunitTest_CppunitTest,sw_core_edit))
+
+$(eval $(call gb_CppunitTest_use_common_precompiled_header,sw_core_edit))
+
+$(eval $(call gb_CppunitTest_add_exception_objects,sw_core_edit, \
+ sw/qa/core/edit/edit \
+))
+
+$(eval $(call gb_CppunitTest_use_libraries,sw_core_edit, \
+ editeng \
+ comphelper \
+ cppu \
+ cppuhelper \
+ sal \
+ sfx \
+ svxcore \
+ sw \
+ test \
+ unotest \
+ utl \
+ vcl \
+ svt \
+ tl \
+ svl \
+))
+
+$(eval $(call gb_CppunitTest_use_externals,sw_core_edit,\
+ boost_headers \
+ libxml2 \
+))
+
+$(eval $(call gb_CppunitTest_set_include,sw_core_edit,\
+ -I$(SRCDIR)/sw/inc \
+ -I$(SRCDIR)/sw/source/core/inc \
+ -I$(SRCDIR)/sw/source/uibase/inc \
+ -I$(SRCDIR)/sw/qa/inc \
+ $$(INCLUDE) \
+))
+
+$(eval $(call gb_CppunitTest_use_api,sw_core_edit,\
+ udkapi \
+ offapi \
+ oovbaapi \
+))
+
+$(eval $(call gb_CppunitTest_use_ure,sw_core_edit))
+$(eval $(call gb_CppunitTest_use_vcl,sw_core_edit))
+
+$(eval $(call gb_CppunitTest_use_rdb,sw_core_edit,services))
+
+$(eval $(call gb_CppunitTest_use_custom_headers,sw_core_edit,\
+ officecfg/registry \
+))
+
+$(eval $(call gb_CppunitTest_use_configuration,sw_core_edit))
+
+$(eval $(call gb_CppunitTest_use_uiconfigs,sw_core_edit, \
+ modules/swriter \
+))
+
+$(eval $(call gb_CppunitTest_use_more_fonts,sw_core_edit))
+
+# vim: set noet sw=4 ts=4:
diff --git a/sw/Module_sw.mk b/sw/Module_sw.mk
index 45b28d52d841..79d90a649385 100644
--- a/sw/Module_sw.mk
+++ b/sw/Module_sw.mk
@@ -114,6 +114,7 @@ $(eval $(call gb_Module_add_slowcheck_targets,sw,\
CppunitTest_sw_core_layout \
CppunitTest_sw_core_unocore \
CppunitTest_sw_core_crsr \
+ CppunitTest_sw_core_edit \
))
ifneq ($(DISABLE_GUI),TRUE)
diff --git a/sw/qa/core/edit/data/redline-hidden.fodt b/sw/qa/core/edit/data/redline-hidden.fodt
new file mode 100644
index 000000000000..10355e3ac485
--- /dev/null
+++ b/sw/qa/core/edit/data/redline-hidden.fodt
@@ -0,0 +1,32 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<office:document xmlns:text="urn:oasis:names:tc:opendocument:xmlns:text:1.0" xmlns:style="urn:oasis:names:tc:opendocument:xmlns:style:1.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:config="urn:oasis:names:tc:opendocument:xmlns:config:1.0" xmlns:fo="urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0" xmlns:ooo="http://openoffice.org/2004/office" xmlns:office="urn:oasis:names:tc:opendocument:xmlns:office:1.0" office:version="1.3" office:mimetype="application/vnd.oasis.opendocument.text">
+ <office:settings>
+ <config:config-item-set config:name="ooo:view-settings">
+ <config:config-item config:name="ShowRedlineChanges" config:type="boolean">false</config:config-item>
+ </config:config-item-set>
+ </office:settings>
+ <office:automatic-styles>
+ <style:page-layout style:name="pm1">
+ <style:page-layout-properties fo:page-width="21.001cm" fo:page-height="29.7cm" fo:margin-top="2cm" fo:margin-bottom="2cm" fo:margin-left="2cm" fo:margin-right="2cm"/>
+ </style:page-layout>
+ </office:automatic-styles>
+ <office:master-styles>
+ <style:master-page style:name="Standard" style:page-layout-name="pm1">
+ </style:master-page>
+ </office:master-styles>
+ <office:body>
+ <office:text>
+ <text:tracked-changes text:track-changes="false">
+ <text:changed-region xml:id="ct51730224" text:id="ct51730224">
+ <text:insertion>
+ <office:change-info>
+ <dc:creator>Creator</dc:creator>
+ <dc:date>2017-04-27T17:12:10</dc:date>
+ </office:change-info>
+ </text:insertion>
+ </text:changed-region>
+ </text:tracked-changes>
+ <text:p><text:change-start text:change-id="ct51730224"/>test<text:change-end text:change-id="ct51730224"/></text:p>
+ </office:text>
+ </office:body>
+</office:document>
diff --git a/sw/qa/core/edit/edit.cxx b/sw/qa/core/edit/edit.cxx
new file mode 100644
index 000000000000..5f6dff479e73
--- /dev/null
+++ b/sw/qa/core/edit/edit.cxx
@@ -0,0 +1,57 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * 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/.
+ */
+
+#include <swmodeltestbase.hxx>
+
+#include <docsh.hxx>
+#include <view.hxx>
+#include <wrtsh.hxx>
+
+#include <editeng/adjustitem.hxx>
+
+char const DATA_DIRECTORY[] = "/sw/qa/core/edit/data/";
+
+namespace
+{
+/// Covers sw/source/core/edit/ fixes.
+class Test : public SwModelTestBase
+{
+public:
+ SwDoc* createSwDoc(const char* pName)
+ {
+ if (!pName)
+ loadURL("private:factory/swriter", nullptr);
+ else
+ load(DATA_DIRECTORY, pName);
+
+ SwXTextDocument* pTextDoc = dynamic_cast<SwXTextDocument*>(mxComponent.get());
+ CPPUNIT_ASSERT(pTextDoc);
+ return pTextDoc->GetDocShell()->GetDoc();
+ }
+};
+}
+
+CPPUNIT_TEST_FIXTURE(Test, testRedlineHidden)
+{
+ // Given a document with ShowRedlineChanges=false:
+ SwDoc* pDoc = createSwDoc("redline-hidden.fodt");
+
+ // When formatting a paragraph by setting the para adjust to center, then make sure setting the
+ // new item set on the paragraph doesn't crash:
+ SwView* pView = pDoc->GetDocShell()->GetView();
+ SfxItemSet aSet(pView->GetPool(), svl::Items<RES_PARATR_ADJUST, RES_PARATR_ADJUST>{});
+ SvxAdjustItem aItem(SvxAdjust::Center, RES_PARATR_ADJUST);
+ aSet.Put(aItem);
+ SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell();
+ pWrtShell->SetAttrSet(aSet, SetAttrMode::DEFAULT, nullptr, true);
+}
+
+CPPUNIT_PLUGIN_IMPLEMENT();
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/source/core/edit/edatmisc.cxx b/sw/source/core/edit/edatmisc.cxx
index e8f82956106f..c70c90182a0b 100644
--- a/sw/source/core/edit/edatmisc.cxx
+++ b/sw/source/core/edit/edatmisc.cxx
@@ -184,8 +184,8 @@ void SwEditShell::SetAttrSet( const SfxItemSet& rSet, SetAttrMode nFlags, SwPaM*
GetDoc()->getIDocumentContentOperations().InsertItemSet(*pCursor, rSet, nFlags, GetLayout());
}
- EndAllAction();
GetDoc()->getIDocumentRedlineAccess().SetRedlineFlags( eOldMode );
+ EndAllAction();
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */