Kaydet (Commit) b7788136 authored tarafından Michael Stahl's avatar Michael Stahl

tdf#100635 sw: fix layout crash caused by field expansion ...

... triggering recursive layout-in-layout where a SwTextFrame
that's being formatted is deleted inside some other frame's
SwTextNode::GetFormatted().

The offending field is a SwAuthorityField that's located in a
fly-frame with FLY_AT_PAGE anchor.

SwPageFrame::GetContentPosition() is only called by field expansion
code, so this shouldn't have an effect on layout.

It already has a fall-back for the case when the frame has invalid
flags, so handle the situation when the SwLineLayout has been
deleted from the SwCache due to overflow the same way,
which prevents the recursive formatting.

Change-Id: I90437edb5692dc2bdec7ad03964588942bde05be
üst aa07f289
...@@ -1433,9 +1433,12 @@ void SwPageFrame::GetContentPosition( const Point &rPt, SwPosition &rPos ) const ...@@ -1433,9 +1433,12 @@ void SwPageFrame::GetContentPosition( const Point &rPt, SwPosition &rPos ) const
else if ( aAct.X() > aRect.Right() ) else if ( aAct.X() > aRect.Right() )
aAct.X() = aRect.Right(); aAct.X() = aRect.Right();
if( !pAct->isFrameAreaDefinitionValid() ) if (!pAct->isFrameAreaDefinitionValid() ||
(pAct->IsTextFrame() && !static_cast<SwTextFrame const*>(pAct)->HasPara()))
{ {
// ContentFrame not formatted -> always on node-beginning // ContentFrame not formatted -> always on node-beginning
// tdf#100635 also if the SwTextFrame would require reformatting,
// which is unwanted in case this is called from text formatting code
SwContentNode* pCNd = const_cast<SwContentNode*>(pAct->GetNode()); SwContentNode* pCNd = const_cast<SwContentNode*>(pAct->GetNode());
OSL_ENSURE( pCNd, "Where is my ContentNode?" ); OSL_ENSURE( pCNd, "Where is my ContentNode?" );
rPos.nNode = *pCNd; rPos.nNode = *pCNd;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment