[Libreoffice-commits] core.git: sw/source

Michael Stahl mstahl at redhat.com
Mon Mar 19 20:29:15 UTC 2018


 sw/source/core/layout/sectfrm.cxx |   18 +++++++++++++++---
 1 file changed, 15 insertions(+), 3 deletions(-)

New commits:
commit 8f0f5353b079073b450c099bea659bcd4848f830
Author: Michael Stahl <mstahl at redhat.com>
Date:   Mon Mar 19 16:54:33 2018 +0100

    sw: more tweaks to sanity check in SwFrame::GetNextSctLeaf()
    
    * ooo50432-1.sxw has a move from a page with columns to a page without
    columns
    * kde327565-1.odt has a move from a page without columns to a page with
    columns
    * novell348228-1.odt has a section inside a fly frame that has no
    mpUpper
    
    Change-Id: I65afbbad7bb1b7aa3bf7cac8ff78e864adf66c3c
    Reviewed-on: https://gerrit.libreoffice.org/51572
    Reviewed-by: Michael Stahl <mstahl at redhat.com>
    Tested-by: Jenkins <ci at libreoffice.org>

diff --git a/sw/source/core/layout/sectfrm.cxx b/sw/source/core/layout/sectfrm.cxx
index e175ee709221..62b3e7f310d3 100644
--- a/sw/source/core/layout/sectfrm.cxx
+++ b/sw/source/core/layout/sectfrm.cxx
@@ -1594,7 +1594,7 @@ SwLayoutFrame *SwFrame::GetNextSctLeaf( MakePageType eMakePage )
 
 #ifndef NDEBUG
     std::vector<SwFrame *> parents;
-    for (SwFrame * pTmp = GetUpper(); !pTmp->IsPageFrame(); pTmp = pTmp->GetUpper())
+    for (SwFrame * pTmp = GetUpper(); pTmp && !pTmp->IsPageFrame(); pTmp = pTmp->GetUpper())
     {
         parents.push_back(pTmp);
     }
@@ -1761,7 +1761,15 @@ SwLayoutFrame *SwFrame::GetNextSctLeaf( MakePageType eMakePage )
 
                 for ( ; iter != parents.end(); ++iter)
                 {
-                    assert(!pTmp->IsPageFrame());
+                    if (pTmp->IsPageFrame())
+                    {
+                        if ((*iter)->IsColumnFrame() &&
+                            (iter + 1) != parents.end() && (*(iter + 1))->IsBodyFrame())
+                        {   // page style has columns - evidently these are
+                            break; // added later?
+                        }
+                        assert(!pTmp->IsPageFrame());
+                    }
                     assert(pTmp->GetType() == (*iter)->GetType());
                     // for cell frames and table frames:
                     // 1) there may be multiple follow frames of the old one
@@ -1802,7 +1810,11 @@ SwLayoutFrame *SwFrame::GetNextSctLeaf( MakePageType eMakePage )
                     }
                     pTmp = pTmp->GetUpper();
                 }
-                assert(pTmp->IsPageFrame());
+                assert(pTmp == nullptr /* SwFlyAtContentFrame case */
+                    || pTmp->IsPageFrame() // usual case
+                       // the new page has columns, but the old page did not
+                    || (pTmp->IsColumnFrame() && pTmp->GetUpper()->IsBodyFrame()
+                        && pTmp->GetUpper()->GetUpper()->IsPageFrame()));
             }
 #endif
 


More information about the Libreoffice-commits mailing list