diff options
author | Michael Stahl <michael.stahl@allotropia.de> | 2023-11-16 19:45:05 +0100 |
---|---|---|
committer | Xisco Fauli <xiscofauli@libreoffice.org> | 2023-11-29 14:13:28 +0100 |
commit | cb504500ec6b9ac8e5ed24a50552edb1e9d4d2d5 (patch) | |
tree | 1892a198e0f9e272002e6f65476a58de5677053d | |
parent | 83f8685504168574f00c24e6ef5d50026c1fda5f (diff) |
sw: fix layout crash in SwObjectFormatterTextFrame::DoFormatObj()
Since commit 15b886f460919ea3dce425a621dc017c2992a96b this is happening
in testForcepoint93, but only on WNT.
The crash is in SwObjectFormatterTextFrame::DoFormatObj() calling
SwObjectFormatterTextFrame::InvalidateFollowObjs() and the mrPageFrame
has been deleted; there is also the m_bAgain flag set in the SwLayAction
up the stack, but the SwObjectFormatter::mpLayAction is null so
DoFormatObj() cannot check this condition.
In the caller CalcContent(), get the SwLayAction from the SwViewShell
and pass it to the SwObjectFormatter, which appears to fix the problem.
Change-Id: Ib3dc34ce39b4aad723251271c24bdd7a6598ab1c
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/159518
Tested-by: Jenkins
Reviewed-by: Michael Stahl <michael.stahl@allotropia.de>
(cherry picked from commit 191babee4f0ec643b80e96b0cd98c2d04ff96e4e)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/159555
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
-rw-r--r-- | sw/source/core/inc/objectformatter.hxx | 3 | ||||
-rw-r--r-- | sw/source/core/layout/fly.cxx | 6 | ||||
-rw-r--r-- | sw/source/core/layout/objectformatter.cxx | 5 |
3 files changed, 9 insertions, 5 deletions
diff --git a/sw/source/core/inc/objectformatter.hxx b/sw/source/core/inc/objectformatter.hxx index 99d8644f2c29..f85c12dc5f2d 100644 --- a/sw/source/core/inc/objectformatter.hxx +++ b/sw/source/core/inc/objectformatter.hxx @@ -166,7 +166,8 @@ class SwObjectFormatter */ static bool FormatObj( SwAnchoredObject& _rAnchoredObj, SwFrame* _pAnchorFrame = nullptr, - const SwPageFrame* _pPageFrame = nullptr ); + const SwPageFrame* _pPageFrame = nullptr, + SwLayAction* pLayAction = nullptr ); }; #endif diff --git a/sw/source/core/layout/fly.cxx b/sw/source/core/layout/fly.cxx index 7fc0a566b9d5..6b4386a67300 100644 --- a/sw/source/core/layout/fly.cxx +++ b/sw/source/core/layout/fly.cxx @@ -1568,7 +1568,8 @@ void SwFlyFrame::Format( vcl::RenderContext* /*pRenderContext*/, const SwBorderA // Thus, <bNoCalcFollow> no longer used by <FormatWidthCols(..)>. void CalcContent( SwLayoutFrame *pLay, bool bNoColl ) { - vcl::RenderContext* pRenderContext = pLay->getRootFrame()->GetCurrShell()->GetOut(); + SwViewShell & rShell(*pLay->getRootFrame()->GetCurrShell()); + vcl::RenderContext* pRenderContext = rShell.GetOut(); SwSectionFrame* pSect; bool bCollect = false; if( pLay->IsSctFrame() ) @@ -1729,7 +1730,8 @@ void CalcContent( SwLayoutFrame *pLay, bool bNoColl ) } } - if ( !SwObjectFormatter::FormatObj( *pAnchoredObj, pAnchorFrame, pAnchorPageFrame ) ) + if (!SwObjectFormatter::FormatObj(*pAnchoredObj, pAnchorFrame, pAnchorPageFrame, + rShell.Imp()->IsAction() ? &rShell.Imp()->GetLayAction() : nullptr)) { bRestartLayoutProcess = true; break; diff --git a/sw/source/core/layout/objectformatter.cxx b/sw/source/core/layout/objectformatter.cxx index b99da6a0fe4b..6395d2f9e3a8 100644 --- a/sw/source/core/layout/objectformatter.cxx +++ b/sw/source/core/layout/objectformatter.cxx @@ -167,7 +167,8 @@ bool SwObjectFormatter::FormatObjsAtFrame( SwFrame& _rAnchorFrame, */ bool SwObjectFormatter::FormatObj( SwAnchoredObject& _rAnchoredObj, SwFrame* _pAnchorFrame, - const SwPageFrame* _pPageFrame ) + const SwPageFrame* _pPageFrame, + SwLayAction * pLayAction) { bool bSuccess( true ); @@ -181,7 +182,7 @@ bool SwObjectFormatter::FormatObj( SwAnchoredObject& _rAnchoredObj, // create corresponding object formatter std::unique_ptr<SwObjectFormatter> pObjFormatter = - SwObjectFormatter::CreateObjFormatter( rAnchorFrame, rPageFrame, nullptr/*_pLayAction*/ ); + SwObjectFormatter::CreateObjFormatter(rAnchorFrame, rPageFrame, pLayAction); if ( pObjFormatter ) { |