summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2021-09-02 13:35:34 +0100
committerMichael Stahl <michael.stahl@allotropia.de>2021-11-17 19:19:34 +0100
commit80152d19a1ae19ad83fa7032a785b38f2cc09377 (patch)
tree909cbf46c34f76613c77d4b69a2dbfcbe685b442
parentofz#37796 limit to numeric_limits<int>::max (diff)
downloadcore-80152d19a1ae19ad83fa7032a785b38f2cc09377.tar.gz
core-80152d19a1ae19ad83fa7032a785b38f2cc09377.zip
ofz#38011 save and restore m_pLastAnchorPos via UnoCursor
when we do some operations that may delete paragraphs Change-Id: I2165dd287771f06c6d0fd061dd7659b06db4bd72 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/121511 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolanm@redhat.com> (cherry picked from commit bc7baa18435000f47f90e47d3300710bcb4cf56b)
-rw-r--r--sw/qa/core/data/ww8/pass/ofz38011-1.docbin0 -> 63022 bytes
-rw-r--r--sw/source/filter/ww8/ww8par2.cxx9
2 files changed, 9 insertions, 0 deletions
diff --git a/sw/qa/core/data/ww8/pass/ofz38011-1.doc b/sw/qa/core/data/ww8/pass/ofz38011-1.doc
new file mode 100644
index 000000000000..8ef58ca5395d
--- /dev/null
+++ b/sw/qa/core/data/ww8/pass/ofz38011-1.doc
Binary files differ
diff --git a/sw/source/filter/ww8/ww8par2.cxx b/sw/source/filter/ww8/ww8par2.cxx
index 487e98791c32..209c594ffcc5 100644
--- a/sw/source/filter/ww8/ww8par2.cxx
+++ b/sw/source/filter/ww8/ww8par2.cxx
@@ -2744,8 +2744,17 @@ void WW8TabDesc::FinishSwTable()
{
m_pIo->m_xRedlineStack->closeall(*m_pIo->m_pPaM->GetPoint());
m_pIo->m_aFrameRedlines.emplace(std::move(m_pIo->m_xRedlineStack));
+
+ // ofz#38011 drop m_pLastAnchorPos during RedlineStack dtor and restore it afterwards to the same
+ // place, or somewhere close if that place got destroyed
+ std::shared_ptr<SwUnoCursor> xLastAnchorCursor(m_pIo->m_pLastAnchorPos ? m_pIo->m_rDoc.CreateUnoCursor(*m_pIo->m_pLastAnchorPos) : nullptr);
+ m_pIo->m_pLastAnchorPos.reset();
+
m_pIo->m_xRedlineStack = std::move(mxOldRedlineStack);
+ if (xLastAnchorCursor)
+ m_pIo->m_pLastAnchorPos.reset(new SwPosition(*xLastAnchorCursor->GetPoint()));
+
WW8DupProperties aDup(m_pIo->m_rDoc,m_pIo->m_xCtrlStck.get());
m_pIo->m_xCtrlStck->SetAttr( *m_pIo->m_pPaM->GetPoint(), 0, false);