summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Stahl <mstahl@redhat.com>2017-04-21 22:44:14 +0200
committerMichael Stahl <mstahl@redhat.com>2017-04-22 00:07:13 +0200
commit4d43f9e9dda5edeeb6e4b99487b5b6a1fae4bd56 (patch)
treea70ee72353b3116fc5f5c3072bf25af47774dd9c
parent512ba28e297ec74fe280308c0a091c7c308a5e55 (diff)
tdf#107126 sw: fix layout crash with section in footnote
SwContentFrame::WouldFit_() contains a hack to temporarily reparent a SwTextFrame. In the bugdoc, there is a SwTextFrame below a SwSectionFrame below a SwFootnoteFrame. The reparenting ignores the SwSectionFrame so the result is a SwTextFrame below SwFootnoteFrame, but it still has its mbInfSct set, hence crashes with a null pointer. If the SwTextFrame is permanently moved later on, in SwFlowFrame::MoveBwd() line 2450 a new SwSectionFrame is created. Change-Id: I45a7ab793b4459e551bd11b7fb83dedc58a6c8da
-rw-r--r--sw/source/core/layout/calcmove.cxx6
1 files changed, 6 insertions, 0 deletions
diff --git a/sw/source/core/layout/calcmove.cxx b/sw/source/core/layout/calcmove.cxx
index 26eda5e3fef2..65fab03a33c8 100644
--- a/sw/source/core/layout/calcmove.cxx
+++ b/sw/source/core/layout/calcmove.cxx
@@ -1868,6 +1868,11 @@ bool SwContentFrame::WouldFit_( SwTwips nSpace,
SwFrame *pOldNext = pTmpFrame->GetNext();
pTmpFrame->RemoveFromLayout();
pTmpFrame->InsertBefore( pNewUpper, nullptr );
+ // tdf#107126 for a section in a footnote, we have only inserted
+ // the SwTextFrame but no SwSectionFrame - reset mbInfSct flag
+ // to avoid crashing (but perhaps we should create a temp
+ // SwSectionFrame here because WidowsAndOrphans checks for that?)
+ pTmpFrame->InvalidateInfFlags();
if ( pFrame->IsTextFrame() &&
( bTstMove ||
static_cast<SwTextFrame*>(pFrame)->HasFollow() ||
@@ -1885,6 +1890,7 @@ bool SwContentFrame::WouldFit_( SwTwips nSpace,
pTmpFrame->RemoveFromLayout();
pTmpFrame->InsertBefore( pUp, pOldNext );
+ pTmpFrame->InvalidateInfFlags(); // restore flags
}
else
{