Blame SOURCES/0001-EditTextObjectImpl-copy-ctor-doesn-t-exactly-copy-Ed.patch

17f16b
From 3925cf39742ebee935498b14571f13f3e8b64b49 Mon Sep 17 00:00:00 2001
17f16b
From: =?UTF-8?q?Caol=C3=A1n=20McNamara?= <caolanm@redhat.com>
17f16b
Date: Sat, 19 Feb 2022 20:43:33 +0000
17f16b
Subject: [PATCH] EditTextObjectImpl copy ctor doesn't exactly copy
17f16b
 EditTextObjectImpl
17f16b
MIME-Version: 1.0
17f16b
Content-Type: text/plain; charset=UTF-8
17f16b
Content-Transfer-Encoding: 8bit
17f16b
17f16b
and this is apparently relied on, so eliding the copy gives unexpected
17f16b
results.
17f16b
17f16b
EditTextObjectImpl::Clone returns a copy of *this, but the
17f16b
EditTextObjectImpl copy ctor explicitly does not copy the "PortionInfo"
17f16b
member, so in:
17f16b
17f16b
commit fb8973f31f111229be5184f4e4223e963ced2c7b
17f16b
Author: Caolán McNamara <caolanm@redhat.com>
17f16b
Date:   Sat Oct 10 19:21:38 2020 +0100
17f16b
17f16b
    ofz#23492 the only user of this ctor throws away the original of the clone
17f16b
17f16b
    so we can take ownership of the original instead
17f16b
17f16b
where the copy was optimized away we want from a state where there was a
17f16b
new EditTextObjectImpl with an empty PortionInfo member to one where the
17f16b
PortionInfo of the EditTextObjectImpl was retained.
17f16b
17f16b
So explicitly clear this unwanted info.
17f16b
17f16b
It's very hard to make rational judgements about code if a copy behaves
17f16b
differently than the orignal :-(
17f16b
17f16b
Change-Id: I642d60841d6bdccbf830f8a2ccdbd9f542a8aa18
17f16b
---
17f16b
 editeng/source/outliner/outliner.cxx | 1 +
17f16b
 1 file changed, 1 insertion(+)
17f16b
17f16b
diff --git a/editeng/source/outliner/outliner.cxx b/editeng/source/outliner/outliner.cxx
17f16b
index 9c474131352c..d48e4a542723 100644
17f16b
--- a/editeng/source/outliner/outliner.cxx
17f16b
+++ b/editeng/source/outliner/outliner.cxx
17f16b
@@ -383,6 +383,7 @@ std::unique_ptr<OutlinerParaObject> Outliner::CreateParaObject( sal_Int32 nStart
17f16b
         aParagraphDataVector[nPara-nStartPara] = *GetParagraph(nPara);
17f16b
     }
17f16b
 
17f16b
+    xText->ClearPortionInfo(); // tdf#147166 the PortionInfo is unwanted here
17f16b
     std::unique_ptr<OutlinerParaObject> pPObj(new OutlinerParaObject(std::move(xText), aParagraphDataVector, bIsEditDoc));
17f16b
     pPObj->SetOutlinerMode(GetMode());
17f16b
 
17f16b
-- 
17f16b
2.35.1
17f16b