diff options
author | Caolán McNamara <caolanm@redhat.com> | 2021-08-18 16:57:18 +0100 |
---|---|---|
committer | Andras Timar <andras.timar@collabora.com> | 2021-12-21 11:29:30 +0100 |
commit | f835cd19bf7ce165508b5009cc3f1d3f14904327 (patch) | |
tree | bde1199d96eb938e59bba2cf21ba240f4659901d /sw/source | |
parent | 2d8d0bef42f63b52cdd084ebda711cc5866d1f66 (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>
Diffstat (limited to 'sw/source')
-rw-r--r-- | sw/source/filter/ww8/ww8par.cxx | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/sw/source/filter/ww8/ww8par.cxx b/sw/source/filter/ww8/ww8par.cxx index 42e8c415b156..a145b13279e4 100644 --- a/sw/source/filter/ww8/ww8par.cxx +++ b/sw/source/filter/ww8/ww8par.cxx @@ -2095,8 +2095,17 @@ void WW8ReaderSave::Restore( SwWW8ImplReader* pRdr ) pRdr->m_xCtrlStck = std::move(mxOldStck); pRdr->m_xRedlineStack->closeall(*pRdr->m_pPaM->GetPoint()); + + // 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); |