From 7d7eb9895e18a48660965a87c9e2136f028e7022 Mon Sep 17 00:00:00 2001 From: Caolán McNamara Date: Tue, 16 Mar 2021 10:18:18 +0000 Subject: tdf#122894 skipping anchor in column in footnote MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit a trawl of crash testing document didn't show up another example and it doesn't seem possible to create this scenario directly in out UI Change-Id: Ie65a51bf609e8bacd261f368f0b8037431c116ed Reviewed-on: https://gerrit.libreoffice.org/c/core/+/112567 Tested-by: Jenkins Reviewed-by: Caolán McNamara Signed-off-by: Xisco Fauli Reviewed-on: https://gerrit.libreoffice.org/c/core/+/112581 Tested-by: Caolán McNamara --- sw/qa/core/layout/data/tdf122894-4.doc | Bin 0 -> 214528 bytes sw/qa/core/layout/layout.cxx | 5 +++++ sw/source/core/layout/objectformattertxtfrm.cxx | 3 ++- 3 files changed, 7 insertions(+), 1 deletion(-) create mode 100644 sw/qa/core/layout/data/tdf122894-4.doc diff --git a/sw/qa/core/layout/data/tdf122894-4.doc b/sw/qa/core/layout/data/tdf122894-4.doc new file mode 100644 index 000000000000..4ebdb53de04f Binary files /dev/null and b/sw/qa/core/layout/data/tdf122894-4.doc differ diff --git a/sw/qa/core/layout/layout.cxx b/sw/qa/core/layout/layout.cxx index e9f1d22bd70b..3f6199f8dd01 100644 --- a/sw/qa/core/layout/layout.cxx +++ b/sw/qa/core/layout/layout.cxx @@ -260,6 +260,11 @@ CPPUNIT_TEST_FIXTURE(SwCoreLayoutTest, testKeepwithnextFullheight) assertXPath(pXmlDoc, "//page[2]/body/txt/anchored/fly", 1); } +CPPUNIT_TEST_FIXTURE(SwCoreLayoutTest, testCrashRemoveFromLayout) +{ + load(DATA_DIRECTORY, "tdf122894-4.doc"); +} + CPPUNIT_PLUGIN_IMPLEMENT(); /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/source/core/layout/objectformattertxtfrm.cxx b/sw/source/core/layout/objectformattertxtfrm.cxx index bf066909251f..98e374a7e5fb 100644 --- a/sw/source/core/layout/objectformattertxtfrm.cxx +++ b/sw/source/core/layout/objectformattertxtfrm.cxx @@ -748,7 +748,8 @@ void SwObjectFormatterTextFrame::FormatAnchorFrameAndItsPrevs( SwTextFrame& _rAn // format the content of the previous columns. // Note: It's a very simple format without formatting objects. SwFrame* pColFrameOfAnchor = _rAnchorTextFrame.FindColFrame(); - if ( pColFrameOfAnchor ) + SAL_WARN_IF(pColFrameOfAnchor && _rAnchorTextFrame.IsInFootnote(), "sw.layout", "tdf#122894 skipping anchor in column in footnote"); + if (pColFrameOfAnchor && !_rAnchorTextFrame.IsInFootnote()) { // #i44049# _rAnchorTextFrame.LockJoin(); -- cgit