Here is an update patch for 3.4 branch with the following fixes:
  * Added missing #if OSL_DEBUG_LEVEL > 1
  * Initialized pPrecede to 0 in constructor

Thanks,

--
Cedric

----- Mail original -----
> Hi all,
>
> Could some of you please review this commit to be backported to the
> 3.4.3 branch fixing a nasty crasher with loads of dupes (fdo#39510)?
>
> http://cgit.freedesktop.org/libreoffice/writer/commit/?id=9ecab7
>
> Thanks for your reviews.
>
> --
> Cédric Bosdonnat
> LibreOffice hacker
> http://documentfoundation.org
> OOo Eclipse Integration developer
> http://cedric.bosdonnat.free.fr
>
> _______________________________________________
> LibreOffice mailing list
> [email protected]
> http://lists.freedesktop.org/mailman/listinfo/libreoffice
>
From 68b27b713285ddee7b44bb9f57e01066e28eb1b1 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?C=C3=A9dric=20Bosdonnat?= <[email protected]>
Date: Tue, 23 Aug 2011 11:36:42 +0200
Subject: [PATCH] cherry-picked core:cc3d0d and fixed a few things

---
 sw/source/core/inc/cntfrm.hxx     |   10 ++++++++++
 sw/source/core/inc/flowfrm.hxx    |   12 +++++++++++-
 sw/source/core/inc/sectfrm.hxx    |    4 ++++
 sw/source/core/inc/tabfrm.hxx     |    4 ++++
 sw/source/core/layout/flowfrm.cxx |   15 ++++++---------
 sw/source/core/text/xmldump.cxx   |   25 +++++++++++++++++++++++++
 6 files changed, 60 insertions(+), 10 deletions(-)

diff --git a/sw/source/core/inc/cntfrm.hxx b/sw/source/core/inc/cntfrm.hxx
index 898715b..5aab722 100644
--- a/sw/source/core/inc/cntfrm.hxx
+++ b/sw/source/core/inc/cntfrm.hxx
@@ -84,6 +84,8 @@ public:
 
     inline const SwCntntFrm *GetFollow() const;
     inline		 SwCntntFrm *GetFollow();
+    inline const SwCntntFrm *GetPrecede() const;
+    inline       SwCntntFrm *GetPrecede();
     SwTxtFrm* FindMaster() const;
 
         //Layoutabhaengiges Cursortravelling
@@ -147,6 +149,14 @@ inline SwCntntFrm *SwCntntFrm::GetFollow()
 {
     return (SwCntntFrm*)SwFlowFrm::GetFollow();
 }
+inline const SwCntntFrm *SwCntntFrm::GetPrecede() const
+{
+    return (const SwCntntFrm*)SwFlowFrm::GetPrecede();
+}
+inline SwCntntFrm *SwCntntFrm::GetPrecede()
+{
+    return (SwCntntFrm*)SwFlowFrm::GetPrecede();
+}
 
 #endif
 
diff --git a/sw/source/core/inc/flowfrm.hxx b/sw/source/core/inc/flowfrm.hxx
index da3e5ca..bc9557a 100644
--- a/sw/source/core/inc/flowfrm.hxx
+++ b/sw/source/core/inc/flowfrm.hxx
@@ -115,6 +115,7 @@ class SwFlowFrm
 protected:
 
     SwFlowFrm *pFollow;
+    SwFlowFrm *pPrecede;
 
     sal_Bool bIsFollow	:1;	//Ist's ein Follow
     sal_Bool bLockJoin	:1;	//Join (und damit deleten) verboten wenn sal_True!
@@ -171,7 +172,10 @@ public:
     const  SwFlowFrm *GetFollow() const	   { return pFollow;   }
            SwFlowFrm *GetFollow()	   	   { return pFollow;   }
            sal_Bool  	  IsAnFollow( const SwFlowFrm *pFlow ) const;
-    inline void   	  SetFollow( SwFlowFrm *pNew ) { pFollow = pNew; }
+    inline void       SetFollow( SwFlowFrm *pNew );
+
+    const  SwFlowFrm *GetPrecede() const   { return pPrecede;   }
+           SwFlowFrm *GetPrecede()         { return pPrecede;   }
 
     sal_Bool IsJoinLocked() const { return bLockJoin; }
     sal_Bool IsAnyJoinLocked() const { return bLockJoin || HasLockedFollow(); }
@@ -249,6 +253,12 @@ inline sal_Bool SwFlowFrm::IsFwdMoveAllowed()
     return rThis.GetIndPrev() != 0;
 }
 
+inline void SwFlowFrm::SetFollow( SwFlowFrm *pNew )
+{
+    pFollow = pNew;
+    if ( pFollow != NULL )
+        pFollow->pPrecede = this;
+}
 
 #endif
 
diff --git a/sw/source/core/inc/sectfrm.hxx b/sw/source/core/inc/sectfrm.hxx
index f9f7a2e..20f68f6 100644
--- a/sw/source/core/inc/sectfrm.hxx
+++ b/sw/source/core/inc/sectfrm.hxx
@@ -128,6 +128,10 @@ public:
 
     bool IsBalancedSection() const;
 
+#if OSL_DEBUG_LEVEL > 1
+    virtual void dumpAsXmlAttributes(xmlTextWriterPtr writer);
+#endif
+
     DECL_FIXEDMEMPOOL_NEWDEL(SwSectionFrm)
 };
 
diff --git a/sw/source/core/inc/tabfrm.hxx b/sw/source/core/inc/tabfrm.hxx
index a81b25b..8e2e507 100644
--- a/sw/source/core/inc/tabfrm.hxx
+++ b/sw/source/core/inc/tabfrm.hxx
@@ -216,6 +216,10 @@ public:
     sal_uInt16 GetBottomLineSize() const;
     // <-- collapsing
 
+#if OSL_DEBUG_LEVEL > 1
+    virtual void dumpAsXmlAttributes(xmlTextWriterPtr writer);
+#endif
+
     DECL_FIXEDMEMPOOL_NEWDEL(SwTabFrm)
 };
 
diff --git a/sw/source/core/layout/flowfrm.cxx b/sw/source/core/layout/flowfrm.cxx
index 9ba8202..51cb49b 100644
--- a/sw/source/core/layout/flowfrm.cxx
+++ b/sw/source/core/layout/flowfrm.cxx
@@ -81,7 +81,8 @@ sal_Bool SwFlowFrm::bMoveBwdJump = sal_False;
 
 SwFlowFrm::SwFlowFrm( SwFrm &rFrm ) :
     rThis( rFrm ),
-    pFollow( 0 )
+    pFollow( 0 ),
+    pPrecede( 0 )
 {
     bLockJoin = bIsFollow = bCntntLock = bOwnFtnNum =
         bFtnLock = bFlyLock = sal_False;
@@ -691,16 +692,12 @@ SwTxtFrm* SwCntntFrm::FindMaster() const
 {
     OSL_ENSURE( IsFollow(), "SwCntntFrm::FindMaster(): !IsFollow" );
 
-    const SwCntntFrm* pCnt = GetPrevCntntFrm();
+    const SwCntntFrm* pPrec = GetPrecede();
 
-    while ( pCnt )
+    if ( pPrec && pPrec->HasFollow() && pPrec->GetFollow() == this )
     {
-        if ( pCnt->HasFollow() && pCnt->GetFollow() == this )
-        {
-            OSL_ENSURE( pCnt->IsTxtFrm(), "NoTxtFrm with follow found" );
-            return (SwTxtFrm*)pCnt;
-        }
-        pCnt = pCnt->GetPrevCntntFrm();
+        OSL_ENSURE( pPrec->IsTxtFrm(), "NoTxtFrm with follow found" );
+        return ( SwTxtFrm* )pPrec;
     }
 
     OSL_FAIL( "Follow ist lost in Space." );
diff --git a/sw/source/core/text/xmldump.cxx b/sw/source/core/text/xmldump.cxx
index 3209fba..2d76660 100644
--- a/sw/source/core/text/xmldump.cxx
+++ b/sw/source/core/text/xmldump.cxx
@@ -29,6 +29,8 @@
 #include "precompiled_sw.hxx"
 
 #include "frame.hxx"
+#include "sectfrm.hxx"
+#include "tabfrm.hxx"
 #include "txtfrm.hxx"
 #include "porlin.hxx"
 #include "porlay.hxx"
@@ -311,6 +313,29 @@ void SwTxtFrm::dumpAsXmlAttributes( xmlTextWriterPtr writer )
     SwFrm::dumpAsXmlAttributes( writer );
     if ( HasFollow() )
         xmlTextWriterWriteFormatAttribute( writer, BAD_CAST( "follow" ), "%p", GetFollow() );
+
+    if ( pPrecede != NULL )
+        xmlTextWriterWriteFormatAttribute( writer, BAD_CAST( "precede" ), "%p", (SwTxtFrm*)pPrecede );
+}
+
+void SwSectionFrm::dumpAsXmlAttributes( xmlTextWriterPtr writer )
+{
+    SwFrm::dumpAsXmlAttributes( writer );
+    if ( HasFollow() )
+        xmlTextWriterWriteFormatAttribute( writer, BAD_CAST( "follow" ), "%p", GetFollow() );
+
+    if ( pPrecede != NULL )
+        xmlTextWriterWriteFormatAttribute( writer, BAD_CAST( "precede" ), "%p", (SwSectionFrm*)pPrecede );
+}
+
+void SwTabFrm::dumpAsXmlAttributes( xmlTextWriterPtr writer )
+{
+    SwFrm::dumpAsXmlAttributes( writer );
+    if ( HasFollow() )
+        xmlTextWriterWriteFormatAttribute( writer, BAD_CAST( "follow" ), "%p", GetFollow() );
+
+    if ( pPrecede != NULL )
+        xmlTextWriterWriteFormatAttribute( writer, BAD_CAST( "precede" ), "%p", (SwTabFrm*)pPrecede );
 }
 
 #endif
-- 
1.7.3.4

_______________________________________________
LibreOffice mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/libreoffice

Reply via email to