[Libreoffice-commits] core.git: sw/qa sw/source

Caolán McNamara (via logerrit) logerrit at kemper.freedesktop.org
Thu Jul 1 20:06:08 UTC 2021


 sw/qa/core/data/ww8/pass/ofz34749-1.doc |binary
 sw/source/filter/ww8/ww8par.hxx         |    8 ++++++++
 sw/source/filter/ww8/ww8par6.cxx        |    3 +++
 3 files changed, 11 insertions(+)

New commits:
commit e803875fbb86b24b39fcd9adcf7df40ed255ea8f
Author:     Caolán McNamara <caolanm at redhat.com>
AuthorDate: Thu Jul 1 14:56:45 2021 +0100
Commit:     Caolán McNamara <caolanm at redhat.com>
CommitDate: Thu Jul 1 22:05:33 2021 +0200

    ofz#34749 don't remove trailing paragraph if something got anchored to it
    
    Change-Id: Ic6eec2f9829c415abd4f2628bc51efbf98f918fb
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/118228
    Tested-by: Jenkins
    Reviewed-by: Caolán McNamara <caolanm at redhat.com>

diff --git a/sw/qa/core/data/ww8/pass/ofz34749-1.doc b/sw/qa/core/data/ww8/pass/ofz34749-1.doc
new file mode 100644
index 000000000000..d657a71b5245
Binary files /dev/null and b/sw/qa/core/data/ww8/pass/ofz34749-1.doc differ
diff --git a/sw/source/filter/ww8/ww8par.hxx b/sw/source/filter/ww8/ww8par.hxx
index 1e86ed8ba991..f1a9c4fde3cb 100644
--- a/sw/source/filter/ww8/ww8par.hxx
+++ b/sw/source/filter/ww8/ww8par.hxx
@@ -924,6 +924,14 @@ public:
     explicit wwExtraneousParas(SwDoc &rDoc) : m_rDoc(rDoc) {}
     ~wwExtraneousParas() { delete_all_from_doc(); }
     void insert(SwTextNode *pTextNode) { m_aTextNodes.insert(pTextNode); }
+    void check_anchor_destination(SwTextNode *pTextNode)
+    {
+        auto it = m_aTextNodes.find(pTextNode);
+        if (it == m_aTextNodes.end())
+            return;
+        SAL_WARN("sw.ww8", "It is unexpected to anchor something in a para scheduled for removal");
+        m_aTextNodes.erase(it);
+    }
     void delete_all_from_doc();
 };
 
diff --git a/sw/source/filter/ww8/ww8par6.cxx b/sw/source/filter/ww8/ww8par6.cxx
index 6dc0a5e5df5b..b391f6ca1cc4 100644
--- a/sw/source/filter/ww8/ww8par6.cxx
+++ b/sw/source/filter/ww8/ww8par6.cxx
@@ -2470,6 +2470,9 @@ bool SwWW8ImplReader::StartApo(const ApoTestResults &rApo, const WW8_TablePos *p
         }
         else
         {
+            // ofz#34749 we shouldn't anchor anything into an 'extra' paragraph scheduled for
+            // removal at end of import, but check if that scenario is happening
+            m_aExtraneousParas.check_anchor_destination(m_pPaM->GetNode().GetTextNode());
             m_xSFlyPara->pFlyFormat = m_rDoc.MakeFlySection(WW8SwFlyPara::eAnchor,
                     m_pPaM->GetPoint(), &aFlySet);
             OSL_ENSURE(m_xSFlyPara->pFlyFormat->GetAnchor().GetAnchorId() ==


More information about the Libreoffice-commits mailing list