[Libreoffice-commits] core.git: Branch 'distro/lhm/libreoffice-6-1+backports' - sw/source

Michael Stahl (via logerrit) logerrit at kemper.freedesktop.org
Mon Jun 24 14:07:59 UTC 2019


 sw/source/core/layout/flowfrm.cxx |   24 +++++++++++++++++++++++-
 1 file changed, 23 insertions(+), 1 deletion(-)

New commits:
commit 6da245521e93d6ea24dee1a4ac0d4fb4d94c0dcf
Author:     Michael Stahl <Michael.Stahl at cib.de>
AuthorDate: Tue Jun 18 17:51:43 2019 +0200
Commit:     Michael Stahl <Michael.Stahl at cib.de>
CommitDate: Mon Jun 24 16:07:09 2019 +0200

    sw: fix assert on layout of ooo63564-1.odt
    
    The problem is that some SwTextFrames (1415 in particular) inside the
    follow-flow-row of a table move backwards, during(!) which the
    follow-flow-row is deleted; i.e., the SwTextFrame was already moved
    backwards by the pNewUpper->Calc() in MoveBwd(), then it is Cut and
    Pasted at the end of pNewUpper, when it is actually already a lower,
    somewhere in the middle...
    
    This triggers the assert in SwFrame::PrepareMake() that was added in
    commit e14056e6e88d9b8d988b7b88b2776a8fc952031b
    
    Prevent this by using the IsDeleteForbidden() check that was introduced
    in commit 0005b330eaed0b5559042d2597fb45e0c9125d7e; this is similar to
    how MoveBwd() already locks section frames to prevent such problems.
    
    Ultimately a regression from 18765b9fa739337d2d891513f6e2fb7c3ce23b50.
    
    Change-Id: I893ec3e491b4cbe1569edf97fec31d3dd74548ed
    Reviewed-on: https://gerrit.libreoffice.org/74298
    Tested-by: Jenkins
    Reviewed-by: Michael Stahl <Michael.Stahl at cib.de>
    (cherry picked from commit 1e6dec4b4313212a3bdc6bb06155fd65e795368b)
    Reviewed-on: https://gerrit.libreoffice.org/74343
    Reviewed-by: Caolán McNamara <caolanm at redhat.com>
    Tested-by: Caolán McNamara <caolanm at redhat.com>
    (cherry picked from commit 0d4d982b9cde760f558d5ad51b238951c1753577)
    Reviewed-on: https://gerrit.libreoffice.org/74355
    Tested-by: Michael Stahl <Michael.Stahl at cib.de>

diff --git a/sw/source/core/layout/flowfrm.cxx b/sw/source/core/layout/flowfrm.cxx
index 4366c98af710..7179876efcb9 100644
--- a/sw/source/core/layout/flowfrm.cxx
+++ b/sw/source/core/layout/flowfrm.cxx
@@ -43,6 +43,7 @@
 #include <txtfrm.hxx>
 #include <notxtfrm.hxx>
 #include <tabfrm.hxx>
+#include <rowfrm.hxx>
 #include <pagedesc.hxx>
 #include <layact.hxx>
 #include <flyfrms.hxx>
@@ -2512,7 +2513,28 @@ bool SwFlowFrame::MoveBwd( bool &rbReformat )
             pSect->ColLock();
             bFollow = pSect->HasFollow();
         }
-        pNewUpper->Calc(m_rThis.getRootFrame()->GetCurrShell()->GetOut());
+
+        {
+            auto const pOld = m_rThis.GetUpper();
+            ::boost::optional<SwFrameDeleteGuard> g;
+            if (m_rThis.GetUpper()->IsCellFrame())
+            {
+                // note: IsFollowFlowRow() is never set for new-style tables
+                SwTabFrame const*const pTabFrame(m_rThis.FindTabFrame());
+                if (   pTabFrame->IsFollow()
+                    && static_cast<SwTabFrame const*>(pTabFrame->GetPrecede())->HasFollowFlowLine()
+                    && pTabFrame->GetFirstNonHeadlineRow() == m_rThis.GetUpper()->GetUpper())
+                {
+                    // lock follow-flow-row (similar to sections above)
+                    g.emplace(m_rThis.GetUpper()->GetUpper());
+                    assert(m_rThis.GetUpper()->GetUpper()->IsDeleteForbidden());
+                }
+            }
+            pNewUpper->Calc(m_rThis.getRootFrame()->GetCurrShell()->GetOut());
+            SAL_WARN_IF(pOld != m_rThis.GetUpper(), "sw.core",
+                    "MoveBwd(): pNewUpper->Calc() moved this frame?");
+        }
+
         m_rThis.Cut();
 
         // optimization: format section, if its size is invalidated and if it's


More information about the Libreoffice-commits mailing list