sw/source/core/layout/calcmove.cxx | 34 ++++++++++++++++++++++++++++++++-- 1 file changed, 32 insertions(+), 2 deletions(-)
New commits: commit d264ba6dcf3482cb54b4e1b16f1102e5ff338b1a Author: Michael Stahl <michael.st...@cib.de> AuthorDate: Wed May 22 17:09:13 2019 +0200 Commit: Thorsten Behrens <thorsten.behr...@cib.de> CommitDate: Fri May 24 14:24:07 2019 +0200 tdf#119109 sw: fix iteration in SwFrame::PrepareCursor() too This is some copypasta, apply the same fix. Change-Id: I096594f6d54fef68e63c982c2963499d24af6d15 Reviewed-on: https://gerrit.libreoffice.org/72798 Tested-by: Jenkins Reviewed-by: Michael Stahl <michael.st...@cib.de> (cherry picked from commit c24299c36c3f94dd1920a6bc1b8c55b2fe6580d3) Reviewed-on: https://gerrit.libreoffice.org/72818 Reviewed-by: Thorsten Behrens <thorsten.behr...@cib.de> (cherry picked from commit 98e4e308b365692ae2798192d6f4ca7e1cbd376e) Reviewed-on: https://gerrit.libreoffice.org/72866 Tested-by: Thorsten Behrens <thorsten.behr...@cib.de> diff --git a/sw/source/core/layout/calcmove.cxx b/sw/source/core/layout/calcmove.cxx index f20d343a0840..8a5271dbad3e 100644 --- a/sw/source/core/layout/calcmove.cxx +++ b/sw/source/core/layout/calcmove.cxx @@ -435,7 +435,20 @@ void SwFrame::PrepareCursor() SwFlowFrame::CastFlowFrame(pFrame)->IsAnFollow( pThis ) ) break; + bool const isLast(pFrame->GetNext() == this); pFrame->MakeAll(getRootFrame()->GetCurrShell()->GetOut()); + if (isLast && pFrame->GetUpper() != GetUpper()) + { + assert(GetUpper()->Lower() == this + // tab frame/section frame may split multiple times + || ( SwFlowFrame::CastFlowFrame(pFrame) + && SwFlowFrame::CastFlowFrame(GetUpper()->Lower()) + && SwFlowFrame::CastFlowFrame(pFrame)->IsAnFollow( + SwFlowFrame::CastFlowFrame(GetUpper()->Lower())) + && GetUpper()->Lower()->GetNext() == this)); + break; // tdf#119109 frame was moved backward, prevent + // FindNext() returning a frame inside this if + } // this is a table! } // With ContentFrames, the chain may be broken while walking through // it. Therefore we have to figure out the next frame in a bit more commit dbcbfb6d0c1ff352fbc4c9ff12daa527e445dd07 Author: Michael Stahl <michael.st...@cib.de> AuthorDate: Wed May 22 17:03:09 2019 +0200 Commit: Thorsten Behrens <thorsten.behr...@cib.de> CommitDate: Fri May 24 14:23:57 2019 +0200 tdf#119109 sw: fix iteration in SwFrame::PrepareMake() The problem is that with the change in SwFlowFrame::MoveBwd(), a SwTextFrame in a table may move backwards during MakeAll(); if the next frame of the moved frame, and the "this" frame in PrepareMake(), is a SwTabFrame, then the pFrame->FindNext() will return not this SwTabFrame, but the first SwTextFrame *inside* the SwTabFrame - hence the iteration will never meet the "pFrame == this" termination condition and the SwTabFrame remains unformatted; this warning is printed: warn:legacy.osl:6874:6874:sw/source/core/layout/calcmove.cxx:296: :-( Layout unstable (this not found). (regression from 18765b9fa739337d2d891513f6e2fb7c3ce23b50) Change-Id: I68207ba9cf68cd5abe51d647cb757176261eda40 Reviewed-on: https://gerrit.libreoffice.org/72797 Tested-by: Jenkins Reviewed-by: Michael Stahl <michael.st...@cib.de> (cherry picked from commit e14056e6e88d9b8d988b7b88b2776a8fc952031b) Reviewed-on: https://gerrit.libreoffice.org/72817 Reviewed-by: Thorsten Behrens <thorsten.behr...@cib.de> (cherry picked from commit 7724fdc2ccf867e526e968ac6c27cc69408ec8ab) Reviewed-on: https://gerrit.libreoffice.org/72865 Tested-by: Thorsten Behrens <thorsten.behr...@cib.de> diff --git a/sw/source/core/layout/calcmove.cxx b/sw/source/core/layout/calcmove.cxx index 3c30ca26803b..f20d343a0840 100644 --- a/sw/source/core/layout/calcmove.cxx +++ b/sw/source/core/layout/calcmove.cxx @@ -307,12 +307,29 @@ void SwFrame::PrepareMake(vcl::RenderContext* pRenderContext) SwFlowFrame::CastFlowFrame(pFrame)->IsAnFollow( pThis ) ) break; + bool const isLast(pFrame->GetNext() == this); + // note: this seems obvious but does *not* hold, a MakeAll() + // could move more than 1 frame backwards! + // that's why FindNext() is used below + // assert(pFrame->GetUpper() == GetUpper()); pFrame->MakeAll(pRenderContext); if( IsSctFrame() && !static_cast<SwSectionFrame*>(this)->GetSection() ) break; + if (isLast && pFrame->GetUpper() != GetUpper()) + { + assert(GetUpper()->Lower() == this + // tab frame/section frame may split multiple times + || ( SwFlowFrame::CastFlowFrame(pFrame) + && SwFlowFrame::CastFlowFrame(GetUpper()->Lower()) + && SwFlowFrame::CastFlowFrame(pFrame)->IsAnFollow( + SwFlowFrame::CastFlowFrame(GetUpper()->Lower())) + && GetUpper()->Lower()->GetNext() == this)); + break; // tdf#119109 frame was moved backward, prevent + // FindNext() returning a frame inside this if + } // this is a table! } // With ContentFrames, the chain may be broken while walking through - // it. Therefore we have to figure out the follower in a bit more + // it. Therefore we have to figure out the next frame in a bit more // complicated way. However, I'll HAVE to get back to myself // sometime again. pFrame = pFrame->FindNext(); @@ -421,7 +438,7 @@ void SwFrame::PrepareCursor() pFrame->MakeAll(getRootFrame()->GetCurrShell()->GetOut()); } // With ContentFrames, the chain may be broken while walking through - // it. Therefore we have to figure out the follower in a bit more + // it. Therefore we have to figure out the next frame in a bit more // complicated way. However, I'll HAVE to get back to myself // sometime again. pFrame = pFrame->FindNext(); _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits