diff options
author | Caolán McNamara <caolanm@redhat.com> | 2021-08-18 16:57:18 +0100 |
---|---|---|
committer | Michael Stahl <michael.stahl@allotropia.de> | 2021-11-17 17:48:13 +0100 |
commit | 81ffdb458e7169312c7b46da2d76cf40a6c51032 (patch) | |
tree | 851380f388d474a1968b86cc6103dbbe8dcb8129 | |
parent | a1899dbbc0c248768a5132643b7986debc05159d (diff) |
ofz#37322 Bad-cast
use a SwUnoCursor for the LastAnchorPos around here, this is similar to
ofz#9858 Bad-cast
Change-Id: I194a39ae13c382740b0ba8145dcc33fb2107105d
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/120679
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
(cherry picked from commit c1cd505c67a53a0a27589889b34641612d10946d)
-rw-r--r-- | sw/qa/core/data/ww5/pass/ooo37322-1-WW2.doc | bin | 0 -> 5559 bytes | |||
-rw-r--r-- | sw/source/filter/ww8/ww8par.cxx | 9 |
2 files changed, 9 insertions, 0 deletions
diff --git a/sw/qa/core/data/ww5/pass/ooo37322-1-WW2.doc b/sw/qa/core/data/ww5/pass/ooo37322-1-WW2.doc Binary files differnew file mode 100644 index 000000000000..fd64eeed2963 --- /dev/null +++ b/sw/qa/core/data/ww5/pass/ooo37322-1-WW2.doc diff --git a/sw/source/filter/ww8/ww8par.cxx b/sw/source/filter/ww8/ww8par.cxx index f5bdacffe32d..1a99e0805e98 100644 --- a/sw/source/filter/ww8/ww8par.cxx +++ b/sw/source/filter/ww8/ww8par.cxx @@ -2076,8 +2076,17 @@ void WW8ReaderSave::Restore( SwWW8ImplReader* pRdr ) pRdr->m_xRedlineStack->closeall(*pRdr->m_pPaM->GetPoint()); pRdr->m_aFrameRedlines.emplace(std::move(pRdr->m_xRedlineStack)); + + // ofz#37322 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(pRdr->m_pLastAnchorPos ? pRdr->m_rDoc.CreateUnoCursor(*pRdr->m_pLastAnchorPos) : nullptr); + pRdr->m_pLastAnchorPos.reset(); + pRdr->m_xRedlineStack = std::move(mxOldRedlines); + if (xLastAnchorCursor) + pRdr->m_pLastAnchorPos.reset(new SwPosition(*xLastAnchorCursor->GetPoint())); + pRdr->DeleteAnchorStack(); pRdr->m_xAnchorStck = std::move(mxOldAnchorStck); |