[Libreoffice-commits] .: Branch 'libreoffice-3-4' - 3 commits - sw/source

Cédric Bosdonnat cbosdo at kemper.freedesktop.org
Mon Feb 13 09:38:25 PST 2012


 sw/source/core/frmedt/tblsel.cxx   |    2 -
 sw/source/core/inc/flowfrm.hxx     |   28 +++++++++------------------
 sw/source/core/layout/flowfrm.cxx  |   38 +++++++++++++++++++++++++++++++++----
 sw/source/core/layout/laycache.cxx |    1 
 sw/source/core/layout/sectfrm.cxx  |   11 ----------
 sw/source/core/layout/ssfrm.cxx    |    3 --
 sw/source/core/layout/tabfrm.cxx   |    1 
 sw/source/core/text/frmform.cxx    |    5 +---
 sw/source/core/text/xmldump.cxx    |   12 +++++------
 9 files changed, 54 insertions(+), 47 deletions(-)

New commits:
commit 4c36086e3a8b546d906e0dd9f0472abd7013852e
Author: Michael Stahl <mstahl at redhat.com>
Date:   Mon Feb 13 18:36:28 2012 +0100

    fdo#41712: sw: remove superfluous flag:
    
    This removes SwFlowFrm::bIsFollow, which is pointless duplication of
    m_pPrecede; this fixes lots of assertions (probably some real problem as
    well).
    
    Signed-off-by: Cédric Bosdonnat <cedric.bosdonnat.ooo at free.fr>

diff --git a/sw/source/core/frmedt/tblsel.cxx b/sw/source/core/frmedt/tblsel.cxx
index 34fd69d..4397073 100644
--- a/sw/source/core/frmedt/tblsel.cxx
+++ b/sw/source/core/frmedt/tblsel.cxx
@@ -2250,7 +2250,7 @@ void _FndBox::SetTableLines( const SwTable &rTable )
 
 inline void UnsetFollow( SwFlowFrm *pTab )
 {
-    pTab->bIsFollow = sal_False;
+    pTab->m_pPrecede = 0;
 }
 
 void _FndBox::DelFrms( SwTable &rTable )
diff --git a/sw/source/core/inc/flowfrm.hxx b/sw/source/core/inc/flowfrm.hxx
index 9617988..8facb39 100644
--- a/sw/source/core/inc/flowfrm.hxx
+++ b/sw/source/core/inc/flowfrm.hxx
@@ -117,7 +117,6 @@ protected:
     SwFlowFrm *m_pFollow;
     SwFlowFrm *m_pPrecede;
 
-    sal_Bool bIsFollow	:1;	//Ist's ein Follow
     sal_Bool bLockJoin	:1;	//Join (und damit deleten) verboten wenn sal_True!
     sal_Bool bUndersized:1; // wir sind kleiner als gewuenscht
     sal_Bool bFtnAtEnd	:1; // For sectionfrms only: footnotes at the end of section
@@ -168,8 +167,7 @@ public:
     void MoveSubTree( SwLayoutFrm* pParent, SwFrm* pSibling = 0 );
 
            sal_Bool 	  HasFollow() const    { return m_pFollow ? sal_True : sal_False; }
-           sal_Bool		  IsFollow()     const { return bIsFollow; }
-    inline void		  _SetIsFollow( sal_Bool bSet ) { bIsFollow = bSet; }
+           sal_Bool		  IsFollow()     const { return 0 != m_pPrecede; }
     const  SwFlowFrm *GetFollow() const	   { return m_pFollow;   }
            SwFlowFrm *GetFollow()	   	   { return m_pFollow;   }
            sal_Bool  	  IsAnFollow( const SwFlowFrm *pFlow ) const;
diff --git a/sw/source/core/layout/flowfrm.cxx b/sw/source/core/layout/flowfrm.cxx
index c5e083f..5b4a588 100644
--- a/sw/source/core/layout/flowfrm.cxx
+++ b/sw/source/core/layout/flowfrm.cxx
@@ -84,7 +84,7 @@ SwFlowFrm::SwFlowFrm( SwFrm &rFrm ) :
     m_pFollow( 0 ),
     m_pPrecede( 0 )
 {
-    bLockJoin = bIsFollow = bCntntLock = bOwnFtnNum =
+    bLockJoin = bCntntLock = bOwnFtnNum =
         bFtnLock = bFlyLock = sal_False;
 }
 
diff --git a/sw/source/core/layout/laycache.cxx b/sw/source/core/layout/laycache.cxx
index 850e38b..61b40ce 100644
--- a/sw/source/core/layout/laycache.cxx
+++ b/sw/source/core/layout/laycache.cxx
@@ -934,7 +934,6 @@ sal_Bool SwLayHelper::CheckInsert( sal_uLong nNodeIndex )
                         {
                             SwTxtFrm *pNew = new SwTxtFrm( ((SwTxtFrm*)rpFrm)->
                                                             GetTxtNode(), rpFrm );
-                            pNew->_SetIsFollow( sal_True );
                             pNew->ManipOfst( nOfst );
                             pNew->SetFollow( ((SwTxtFrm*)rpFrm)->GetFollow() );
                             ((SwTxtFrm*)rpFrm)->SetFollow( pNew );
diff --git a/sw/source/core/layout/sectfrm.cxx b/sw/source/core/layout/sectfrm.cxx
index eee5a68..60e6d2d 100644
--- a/sw/source/core/layout/sectfrm.cxx
+++ b/sw/source/core/layout/sectfrm.cxx
@@ -102,15 +102,11 @@ SwSectionFrm::SwSectionFrm( SwSectionFrm &rSect, sal_Bool bMaster ) :
         {
             SwSectionFrm* pMaster = rSect.FindMaster();
             pMaster->SetFollow( this );
-            bIsFollow = sal_True;
         }
-        else
-            rSect.bIsFollow = sal_True;
         SetFollow( &rSect );
     }
     else
     {
-        bIsFollow = sal_True;
         SetFollow( rSect.GetFollow() );
         rSect.SetFollow( this );
         if( !GetFollow() )
@@ -171,7 +167,6 @@ SwSectionFrm::~SwSectionFrm()
         else if( HasFollow() )
         {
             PROTOCOL( this, PROT_SECTION, ACT_DEL_MASTER, GetFollow() )
-            GetFollow()->bIsFollow = sal_False;
         }
     }
 }
@@ -219,10 +214,7 @@ void SwSectionFrm::DelEmpty( sal_Bool bRemove )
         // freigeben, deshalb wird die Size des Masters invalidiert.
         if( !GetFollow() && !pMaster->IsColLocked() )
             pMaster->InvalidateSize();
-        bIsFollow = sal_False;
     }
-    else if( HasFollow() )
-        GetFollow()->bIsFollow = sal_False;
     SetFollow(0);
     if( pUp )
     {
@@ -506,7 +498,6 @@ void SwSectionFrm::MergeNext( SwSectionFrm* pNxt )
         }
         SetFollow( pNxt->GetFollow() );
         pNxt->SetFollow( NULL );
-        pNxt->bIsFollow = sal_False;
         pNxt->Cut();
         delete pNxt;
         InvalidateSize();
diff --git a/sw/source/core/layout/ssfrm.cxx b/sw/source/core/layout/ssfrm.cxx
index b2dc389..6ac8bc7 100644
--- a/sw/source/core/layout/ssfrm.cxx
+++ b/sw/source/core/layout/ssfrm.cxx
@@ -523,13 +523,10 @@ void SwCntntFrm::DelFrms( const SwCntntNode& rNode )
             }
         }
         // <--
-        if( pFrm->HasFollow() )
-            pFrm->GetFollow()->_SetIsFollow( pFrm->IsFollow() );
         if( pFrm->IsFollow() )
         {
             SwCntntFrm* pMaster = (SwTxtFrm*)pFrm->FindMaster();
             pMaster->SetFollow( pFrm->GetFollow() );
-            pFrm->_SetIsFollow( sal_False );
         }
         pFrm->SetFollow( 0 );//Damit er nicht auf dumme Gedanken kommt.
                                 //Andernfalls kann es sein, dass ein Follow
diff --git a/sw/source/core/layout/tabfrm.cxx b/sw/source/core/layout/tabfrm.cxx
index aaa73ca..d8a2a02 100644
--- a/sw/source/core/layout/tabfrm.cxx
+++ b/sw/source/core/layout/tabfrm.cxx
@@ -124,7 +124,6 @@ SwTabFrm::SwTabFrm( SwTabFrm &rTab ) :
     SwFlowFrm( (SwFrm&)*this ),
     pTable( rTab.GetTable() )
 {
-    bIsFollow = sal_True;
     bLockJoin = bComplete = bONECalcLowers = bCalcLowers = bLowersFormatted = bLockBackMove =
     bResizeHTMLTable = bHasFollowFlowLine = bIsRebuildLastLine =
     bRestrictTableGrowth = bRemoveFollowFlowLinePending = sal_False;
diff --git a/sw/source/core/text/frmform.cxx b/sw/source/core/text/frmform.cxx
index 464eab7..dd5495f 100644
--- a/sw/source/core/text/frmform.cxx
+++ b/sw/source/core/text/frmform.cxx
@@ -701,7 +701,6 @@ SwCntntFrm *SwTxtFrm::SplitFrm( const xub_StrLen nTxtPos )
     // Damit meine Daten nicht verschwinden, locke ich mich.
     SwTxtFrmLocker aLock( this );
     SwTxtFrm *pNew = (SwTxtFrm *)(GetTxtNode()->MakeFrm( this ));
-    pNew->bIsFollow = sal_True;
 
     pNew->SetFollow( GetFollow() );
     SetFollow( pNew );
commit 33e8891ea9d75519da56431073897a57ab251d6a
Author: Michael Stahl <mstahl at redhat.com>
Date:   Mon Feb 13 18:27:59 2012 +0100

    fdo#41712: sw: fix crash in layout frame linked lists:
    
    The pPrecede member is not maintained properly when setting the
    corresponding pFollow member.
    The change in SwTxtFrm::JoinFrm() fixes the crash, the other changes
    are perhaps fixes for other crashes...
    (regression from cc3d0d182cafef9649e45f4657233ac2221fdd0a)
    
    Signed-off-by: Cédric Bosdonnat <cedric.bosdonnat.ooo at free.fr>

diff --git a/sw/source/core/inc/flowfrm.hxx b/sw/source/core/inc/flowfrm.hxx
index 1f9009d..9617988 100644
--- a/sw/source/core/inc/flowfrm.hxx
+++ b/sw/source/core/inc/flowfrm.hxx
@@ -150,6 +150,7 @@ protected:
 
 public:
     SwFlowFrm( SwFrm &rFrm );
+    virtual ~SwFlowFrm();
 
     const SwFrm *GetFrm() const 		   { return &rThis; }
           SwFrm *GetFrm()				   { return &rThis; }
diff --git a/sw/source/core/layout/flowfrm.cxx b/sw/source/core/layout/flowfrm.cxx
index 738c7e3..c5e083f 100644
--- a/sw/source/core/layout/flowfrm.cxx
+++ b/sw/source/core/layout/flowfrm.cxx
@@ -88,12 +88,33 @@ SwFlowFrm::SwFlowFrm( SwFrm &rFrm ) :
         bFtnLock = bFlyLock = sal_False;
 }
 
+SwFlowFrm::~SwFlowFrm()
+{
+    if (m_pFollow)
+    {
+        m_pFollow->m_pPrecede = 0;
+    }
+    if (m_pPrecede)
+    {
+        m_pPrecede->m_pFollow = 0;
+    }
+}
 
 void SwFlowFrm::SetFollow(SwFlowFrm *const pFollow)
 {
+    if (m_pFollow)
+    {
+        assert(this == m_pFollow->m_pPrecede);
+        m_pFollow->m_pPrecede = 0;
+    }
     m_pFollow = pFollow;
     if (m_pFollow != NULL)
     {
+        if (m_pFollow->m_pPrecede) // re-chaining pFollow?
+        {
+            assert(m_pFollow == m_pFollow->m_pPrecede->m_pFollow);
+            m_pFollow->m_pPrecede->m_pFollow = 0;
+        }
         m_pFollow->m_pPrecede = this;
     }
 }
diff --git a/sw/source/core/layout/sectfrm.cxx b/sw/source/core/layout/sectfrm.cxx
index 2b21733..eee5a68 100644
--- a/sw/source/core/layout/sectfrm.cxx
+++ b/sw/source/core/layout/sectfrm.cxx
@@ -223,7 +223,7 @@ void SwSectionFrm::DelEmpty( sal_Bool bRemove )
     }
     else if( HasFollow() )
         GetFollow()->bIsFollow = sal_False;
-    m_pFollow = NULL;
+    SetFollow(0);
     if( pUp )
     {
         Frm().Height( 0 );
diff --git a/sw/source/core/text/frmform.cxx b/sw/source/core/text/frmform.cxx
index 619c700..464eab7 100644
--- a/sw/source/core/text/frmform.cxx
+++ b/sw/source/core/text/frmform.cxx
@@ -684,8 +684,8 @@ SwCntntFrm *SwTxtFrm::JoinFrm()
     }
     // <--
     pFoll->Cut();
+    SetFollow(pNxt);
     delete pFoll;
-    m_pFollow = pNxt;
     return pNxt;
 }
 
commit e1dad1357ac57009483d232f2c8a9dccebbf69c3
Author: Michael Stahl <mstahl at redhat.com>
Date:   Mon Feb 13 18:21:53 2012 +0100

    fdo#41712: rename members to track down assignments
    
    Signed-off-by: Cédric Bosdonnat <cedric.bosdonnat.ooo at free.fr>

diff --git a/sw/source/core/inc/flowfrm.hxx b/sw/source/core/inc/flowfrm.hxx
index bc9557a..1f9009d 100644
--- a/sw/source/core/inc/flowfrm.hxx
+++ b/sw/source/core/inc/flowfrm.hxx
@@ -114,8 +114,8 @@ class SwFlowFrm
 
 protected:
 
-    SwFlowFrm *pFollow;
-    SwFlowFrm *pPrecede;
+    SwFlowFrm *m_pFollow;
+    SwFlowFrm *m_pPrecede;
 
     sal_Bool bIsFollow	:1;	//Ist's ein Follow
     sal_Bool bLockJoin	:1;	//Join (und damit deleten) verboten wenn sal_True!
@@ -166,16 +166,16 @@ public:
     //neuen Parent Moven.
     void MoveSubTree( SwLayoutFrm* pParent, SwFrm* pSibling = 0 );
 
-           sal_Bool 	  HasFollow() const    { return pFollow ? sal_True : sal_False; }
+           sal_Bool 	  HasFollow() const    { return m_pFollow ? sal_True : sal_False; }
            sal_Bool		  IsFollow()     const { return bIsFollow; }
     inline void		  _SetIsFollow( sal_Bool bSet ) { bIsFollow = bSet; }
-    const  SwFlowFrm *GetFollow() const	   { return pFollow;   }
-           SwFlowFrm *GetFollow()	   	   { return pFollow;   }
+    const  SwFlowFrm *GetFollow() const	   { return m_pFollow;   }
+           SwFlowFrm *GetFollow()	   	   { return m_pFollow;   }
            sal_Bool  	  IsAnFollow( const SwFlowFrm *pFlow ) const;
-    inline void       SetFollow( SwFlowFrm *pNew );
+    void       SetFollow( SwFlowFrm *const pFollow );
 
-    const  SwFlowFrm *GetPrecede() const   { return pPrecede;   }
-           SwFlowFrm *GetPrecede()         { return pPrecede;   }
+    const  SwFlowFrm *GetPrecede() const   { return m_pPrecede;   }
+           SwFlowFrm *GetPrecede()         { return m_pPrecede;   }
 
     sal_Bool IsJoinLocked() const { return bLockJoin; }
     sal_Bool IsAnyJoinLocked() const { return bLockJoin || HasLockedFollow(); }
@@ -253,13 +253,6 @@ inline sal_Bool SwFlowFrm::IsFwdMoveAllowed()
     return rThis.GetIndPrev() != 0;
 }
 
-inline void SwFlowFrm::SetFollow( SwFlowFrm *pNew )
-{
-    pFollow = pNew;
-    if ( pFollow != NULL )
-        pFollow->pPrecede = this;
-}
-
 #endif
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/source/core/layout/flowfrm.cxx b/sw/source/core/layout/flowfrm.cxx
index 51cb49b..738c7e3 100644
--- a/sw/source/core/layout/flowfrm.cxx
+++ b/sw/source/core/layout/flowfrm.cxx
@@ -81,14 +81,23 @@ sal_Bool SwFlowFrm::bMoveBwdJump = sal_False;
 
 SwFlowFrm::SwFlowFrm( SwFrm &rFrm ) :
     rThis( rFrm ),
-    pFollow( 0 ),
-    pPrecede( 0 )
+    m_pFollow( 0 ),
+    m_pPrecede( 0 )
 {
     bLockJoin = bIsFollow = bCntntLock = bOwnFtnNum =
         bFtnLock = bFlyLock = sal_False;
 }
 
 
+void SwFlowFrm::SetFollow(SwFlowFrm *const pFollow)
+{
+    m_pFollow = pFollow;
+    if (m_pFollow != NULL)
+    {
+        m_pFollow->m_pPrecede = this;
+    }
+}
+
 /*************************************************************************
 |*
 |*  SwFlowFrm::IsFollowLocked()
@@ -215,7 +224,7 @@ sal_Bool SwFlowFrm::IsKeep( const SwAttrSet& rAttrs, bool bCheckIfLastRowShouldK
         {
             SwFrm *pNxt;
             if( 0 != (pNxt = rThis.FindNextCnt()) &&
-                (!pFollow || pNxt != pFollow->GetFrm()))
+                (!m_pFollow || pNxt != m_pFollow->GetFrm()))
             {
                 // --> FME 2006-05-15 #135914#
                 // The last row of a table only keeps with the next content
diff --git a/sw/source/core/layout/sectfrm.cxx b/sw/source/core/layout/sectfrm.cxx
index 6f8bf2f..2b21733 100644
--- a/sw/source/core/layout/sectfrm.cxx
+++ b/sw/source/core/layout/sectfrm.cxx
@@ -223,7 +223,7 @@ void SwSectionFrm::DelEmpty( sal_Bool bRemove )
     }
     else if( HasFollow() )
         GetFollow()->bIsFollow = sal_False;
-    pFollow = NULL;
+    m_pFollow = NULL;
     if( pUp )
     {
         Frm().Height( 0 );
diff --git a/sw/source/core/text/frmform.cxx b/sw/source/core/text/frmform.cxx
index c383c7e..619c700 100644
--- a/sw/source/core/text/frmform.cxx
+++ b/sw/source/core/text/frmform.cxx
@@ -685,7 +685,7 @@ SwCntntFrm *SwTxtFrm::JoinFrm()
     // <--
     pFoll->Cut();
     delete pFoll;
-    pFollow = pNxt;
+    m_pFollow = pNxt;
     return pNxt;
 }
 
@@ -2050,7 +2050,7 @@ sal_Bool SwTxtFrm::FormatQuick( bool bForceQuickFormat )
         return sal_False;
     }
 
-    if( pFollow && nStart != ((SwTxtFrm*)pFollow)->GetOfst() )
+    if( m_pFollow && nStart != (static_cast<SwTxtFrm*>(m_pFollow))->GetOfst() )
         return sal_False; // kann z.B. durch Orphans auftreten (35083,35081)
 
     // Geschafft, wir sind durch ...
diff --git a/sw/source/core/text/xmldump.cxx b/sw/source/core/text/xmldump.cxx
index 2d76660..5a65799 100644
--- a/sw/source/core/text/xmldump.cxx
+++ b/sw/source/core/text/xmldump.cxx
@@ -314,8 +314,8 @@ void SwTxtFrm::dumpAsXmlAttributes( xmlTextWriterPtr writer )
     if ( HasFollow() )
         xmlTextWriterWriteFormatAttribute( writer, BAD_CAST( "follow" ), "%p", GetFollow() );
 
-    if ( pPrecede != NULL )
-        xmlTextWriterWriteFormatAttribute( writer, BAD_CAST( "precede" ), "%p", (SwTxtFrm*)pPrecede );
+    if ( m_pPrecede != NULL )
+        xmlTextWriterWriteFormatAttribute( writer, BAD_CAST( "precede" ), "%p", (SwTxtFrm*)m_pPrecede );
 }
 
 void SwSectionFrm::dumpAsXmlAttributes( xmlTextWriterPtr writer )
@@ -324,8 +324,8 @@ void SwSectionFrm::dumpAsXmlAttributes( xmlTextWriterPtr writer )
     if ( HasFollow() )
         xmlTextWriterWriteFormatAttribute( writer, BAD_CAST( "follow" ), "%p", GetFollow() );
 
-    if ( pPrecede != NULL )
-        xmlTextWriterWriteFormatAttribute( writer, BAD_CAST( "precede" ), "%p", (SwSectionFrm*)pPrecede );
+    if ( m_pPrecede != NULL )
+        xmlTextWriterWriteFormatAttribute( writer, BAD_CAST( "precede" ), "%p", (SwSectionFrm*)m_pPrecede );
 }
 
 void SwTabFrm::dumpAsXmlAttributes( xmlTextWriterPtr writer )
@@ -334,8 +334,8 @@ void SwTabFrm::dumpAsXmlAttributes( xmlTextWriterPtr writer )
     if ( HasFollow() )
         xmlTextWriterWriteFormatAttribute( writer, BAD_CAST( "follow" ), "%p", GetFollow() );
 
-    if ( pPrecede != NULL )
-        xmlTextWriterWriteFormatAttribute( writer, BAD_CAST( "precede" ), "%p", (SwTabFrm*)pPrecede );
+    if ( m_pPrecede != NULL )
+        xmlTextWriterWriteFormatAttribute( writer, BAD_CAST( "precede" ), "%p", (SwTabFrm*)m_pPrecede );
 }
 
 #endif


More information about the Libreoffice-commits mailing list