From 04159aab6827e22a67a0c7bc4d68b4a999d51318 Mon Sep 17 00:00:00 2001 From: Michael Stahl Date: Fri, 6 Dec 2019 17:39:56 +0100 Subject: ofz#18563 sw: remove SwXFrame::m_pCopySource to fix ~SwIndexReg assert The problem is that a text frame is inserted with a selection that partially selects a fieldmark, so the DeleteAndJoin() is split across multiple calls with a temporary cursor, and the correction of the passed in rPam that is ultimately SwXFrame::m_pCopySource is not done, so it remains on a deleted node. Replace it with a SwUnoCursor, which is automatically corrected. It turns out that this m_pCopySource member was only set via a call to SetSelection() from one place in SwXText::convertToTextFrame(), which ends up immediately calling SwXFrame::attach() anyway, which then uses m_pCopySource and resets it. This was added in deba85c5b73f36affe672567ed4a45938953f312 but it would be far simpler to just pass a local variable to SwXFrame::attachToRange(). Change-Id: I85ed128db63c13f81f215d8f50036d9d2aa6c519 Reviewed-on: https://gerrit.libreoffice.org/84661 Tested-by: Jenkins Reviewed-by: Michael Stahl --- sw/inc/unoframe.hxx | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'sw/inc/unoframe.hxx') diff --git a/sw/inc/unoframe.hxx b/sw/inc/unoframe.hxx index 074f7b814535..6fcce7a82032 100644 --- a/sw/inc/unoframe.hxx +++ b/sw/inc/unoframe.hxx @@ -71,8 +71,6 @@ private: bool bIsDescriptor; OUString m_sName; - std::unique_ptr m_pCopySource; - sal_Int64 m_nDrawAspect; sal_Int64 m_nVisibleAreaWidth; sal_Int64 m_nVisibleAreaHeight; @@ -148,7 +146,8 @@ public: /// @throws css::lang::IllegalArgumentException /// @throws css::uno::RuntimeException - void attachToRange(const css::uno::Reference< css::text::XTextRange > & xTextRange); + void attachToRange(css::uno::Reference const& xTextRange, + SwPaM const* pCopySource = nullptr); const SwFrameFormat* GetFrameFormat() const { return m_pFrameFormat; } -- cgit