[libreoffice/f16] Resolves: rhbz#789022 SwNodes: fix inconsistent outline check

Michael Stahl mstahl at fedoraproject.org
Fri Mar 23 23:33:13 UTC 2012


commit 6f185b7d79173899c52290331554977227be1e07
Author: Michael Stahl <mstahl at redhat.com>
Date:   Sat Mar 24 00:31:40 2012 +0100

    Resolves: rhbz#789022 SwNodes: fix inconsistent outline check

 ...22-SwNodes-fix-inconsistent-outline-check.patch |  136 ++++++++++++++++++++
 libreoffice.spec                                   |    4 +
 2 files changed, 140 insertions(+), 0 deletions(-)
---
diff --git a/0001-rhbz-789022-SwNodes-fix-inconsistent-outline-check.patch b/0001-rhbz-789022-SwNodes-fix-inconsistent-outline-check.patch
new file mode 100644
index 0000000..0e5a3fc
--- /dev/null
+++ b/0001-rhbz-789022-SwNodes-fix-inconsistent-outline-check.patch
@@ -0,0 +1,136 @@
+From 082906e1f4cf58fdfab1a4064e2b7955fcdaeb8a Mon Sep 17 00:00:00 2001
+From: Michael Stahl <mstahl at redhat.com>
+Date: Wed, 21 Mar 2012 10:25:45 +0100
+Subject: [PATCH] rhbz#789022: SwNodes: fix inconsistent outline check:
+
+SwNodes::UpdateOutlineNode will add/remove the node from
+SwNodes::pOutlineNds depending on IsOutline(), while various SwNodes
+methods that move and delete nodes check GetAttrOutlineLevel() != 0,
+which may be false even if IsOutline() is true.
+---
+ sw/source/core/docnode/nodes.cxx |   34 +++++++++++++++++-----------------
+ sw/source/core/txtnode/ndtxt.cxx |    6 ++++++
+ 2 files changed, 23 insertions(+), 17 deletions(-)
+
+diff --git a/sw/source/core/docnode/nodes.cxx b/sw/source/core/docnode/nodes.cxx
+index 518de82..ab12430 100644
+--- a/sw/source/core/docnode/nodes.cxx
++++ b/sw/source/core/docnode/nodes.cxx
+@@ -173,7 +173,7 @@ void SwNodes::ChgNode( SwNodeIndex& rDelPos, sal_uLong nSz,
+ 
+                 pTxtNode->RemoveFromList();
+ 
+-                if ( pTxtNode->GetAttrOutlineLevel() != 0 )//<-end,zhaojianwei
++                if (pTxtNode->IsOutline())
+                 {
+                     const SwNodePtr pSrch = (SwNodePtr)&rNd;
+                     pOutlineNds->Remove( pSrch );
+@@ -188,8 +188,7 @@ void SwNodes::ChgNode( SwNodeIndex& rDelPos, sal_uLong nSz,
+ 
+                 rTxtNd.AddToList();
+ 
+-                if( bInsOutlineIdx &&
+-                    0 != rTxtNd.GetAttrOutlineLevel() )//<-end,zhaojianwei
++                if (bInsOutlineIdx && rTxtNd.IsOutline())
+                 {
+                     const SwNodePtr pSrch = (SwNodePtr)&rNd;
+                     pOutlineNds->Insert( pSrch );
+@@ -232,9 +231,11 @@ void SwNodes::ChgNode( SwNodeIndex& rDelPos, sal_uLong nSz,
+             {
+                 SwTxtNode* pTxtNd = (SwTxtNode*)pNd;
+ 
+-                // loesche die Gliederungs-Indizies aus dem alten Nodes-Array
+-                if( 0 != pTxtNd->GetAttrOutlineLevel() )//<-end,zhaojianwei
++                // remove outline index from old nodes array
++                if (pTxtNd->IsOutline())
++                {
+                     pOutlineNds->Remove( pNd );
++                }
+ 
+                 // muss die Rule kopiere werden?
+                 if( pDestDoc )
+@@ -269,8 +270,7 @@ void SwNodes::ChgNode( SwNodeIndex& rDelPos, sal_uLong nSz,
+                 {
+                     SwpHints * const pHts = pTxtNd->GetpSwpHints();
+                     // OultineNodes set the new nodes in the array
+-                    if( bInsOutlineIdx &&
+-                        0 != pTxtNd->GetAttrOutlineLevel() ) //#outline level,added by zhaojianwei
++                    if (bInsOutlineIdx && pTxtNd->IsOutline())
+                     {
+                         rNds.pOutlineNds->Insert( pTxtNd );
+                     }
+@@ -537,12 +537,12 @@ sal_Bool SwNodes::_MoveNodes( const SwNodeRange& aRange, SwNodes & rNodes,
+                                 if( pTmpNd->IsTxtNode() )
+                                     ((SwTxtNode*)pTmpNd)->RemoveFromList();
+ 
+-                                // setze bei Start/EndNodes die richtigen Indizies
+-                                // loesche die Gliederungs-Indizies aus
+-                                // dem alten Nodes-Array
+-                                if( pCNd->IsTxtNode() && 0 !=
+-                                    ((SwTxtNode*)pCNd)->GetAttrOutlineLevel() )//<-end,by zhaojianwei
++                                // remove outline index from old nodes array
++                                if (pCNd->IsTxtNode() &&
++                                    static_cast<SwTxtNode*>(pCNd)->IsOutline())
++                                {
+                                     pOutlineNds->Remove( pCNd );
++                                }
+                                 else
+                                     pCNd = 0;
+                             }
+@@ -572,7 +572,7 @@ sal_Bool SwNodes::_MoveNodes( const SwNodeRange& aRange, SwNodes & rNodes,
+                             SwNode* pNd = &aMvIdx.GetNode();
+ 
+                             const bool bOutlNd = pNd->IsTxtNode() &&
+-                                    0 != ((SwTxtNode*)pNd)->GetAttrOutlineLevel();//<-end,zhaojianwei
++                                static_cast<SwTxtNode*>(pNd)->IsOutline();
+                             // loesche die Gliederungs-Indizies aus
+                             // dem alten Nodes-Array
+                             if( bOutlNd )
+@@ -1221,14 +1221,15 @@ void SwNodes::Delete(const SwNodeIndex &rIndex, sal_uLong nNodes)
+ 
+                     if( pNd->IsTxtNode() )
+                     {
+-                        if( 0 != ((SwTxtNode*)pNd)->GetAttrOutlineLevel() &&//<-end,zhaojianwei
++                        SwTxtNode *const pTxtNode(static_cast<SwTxtNode*>(pNd));
++                        if (pTxtNode->IsOutline() &&
+                                 pOutlineNds->Seek_Entry( pNd, &nIdxPos ))
+                         {
+                             // loesche die Gliederungs-Indizies.
+                             pOutlineNds->Remove( nIdxPos );
+                             bUpdateOutline = sal_True;
+                         }
+-                        ((SwTxtNode*)pNd)->InvalidateNumRule();
++                        pTxtNode->InvalidateNumRule();
+                     }
+                     else if( pNd->IsEndNode() &&
+                             pNd->pStartOfSection->IsTableNode() )
+@@ -1522,8 +1523,7 @@ void SwNodes::DelNodes( const SwNodeIndex & rStart, sal_uLong nCnt )
+         {
+             SwNode* pNd = (*this)[ n ];
+ 
+-            if( pNd->IsTxtNode() &&
+-                0 != ((SwTxtNode*)pNd)->GetAttrOutlineLevel() ) //<-end,zhaojianwei
++            if (pNd->IsTxtNode() && static_cast<SwTxtNode*>(pNd)->IsOutline())
+             {                   // loesche die Gliederungs-Indizies.
+                 sal_uInt16 nIdxPos;
+                 if( pOutlineNds->Seek_Entry( pNd, &nIdxPos ))
+diff --git a/sw/source/core/txtnode/ndtxt.cxx b/sw/source/core/txtnode/ndtxt.cxx
+index 2691f28..fa6f3b0 100644
+--- a/sw/source/core/txtnode/ndtxt.cxx
++++ b/sw/source/core/txtnode/ndtxt.cxx
+@@ -261,6 +261,12 @@ SwTxtNode::~SwTxtNode()
+         delete pTmpHints;
+     }
+ 
++    // must be removed from outline nodes by now
++#if OSL_DEBUG_LEVEL > 0
++    sal_uInt16 foo;
++    assert(!GetNodes().GetOutLineNds().Seek_Entry(this, &foo));
++#endif
++
+     RemoveFromList();
+ 
+     InitSwParaStatistics( false );
+-- 
+1.7.7.6
+
diff --git a/libreoffice.spec b/libreoffice.spec
index 2c3a90c..2ab1a7e 100644
--- a/libreoffice.spec
+++ b/libreoffice.spec
@@ -242,6 +242,7 @@ Patch120: 0001-Splash-screen-fix-for-multi-head-on-Linux-fdo-33214.patch
 Patch121: 0001-Resolves-rhbz-800272-complain-about-unknown-command-.patch
 Patch122: 0001-desktop-do-not-complain-about-soffice-command-line-o.patch
 Patch123: 0001-fix-setting-of-paper-tray-from-print-dialog-fdo-4393.patch
+Patch124: 0001-rhbz-789022-SwNodes-fix-inconsistent-outline-check.patch
 
 %{!?python_sitearch: %global python_sitearch %(%{__python} -c "from distutils.sysconfig import get_python_lib; print(get_python_lib(1))")}
 %define instdir %{_libdir}
@@ -1168,6 +1169,8 @@ mv -f redhat.soc extras/source/palettes/standard.soc
 %patch121 -p1 -b .rhbz-800272-complain-about-unknown-command-.patch
 %patch122 -p1 -b .desktop-do-not-complain-about-soffice-command-line-o.patch
 %patch123 -p1 -b .fix-setting-of-paper-tray-from-print-dialog-fdo-4393.patch
+%patch124 -p1 -b .rhbz-789022-SwNodes-fix-inconsistent-outline-check.patch
+
 # these are horribly incomplete--empty translations and copied english
 # strings with spattering of translated strings
 rm -rf translations/source/{gu,he,hr}/helpcontent2
@@ -2488,6 +2491,7 @@ update-desktop-database %{_datadir}/applications &> /dev/null || :
 %changelog
 * Tue Mar 14 2012 Caolán McNamara <caolanm at redhat.com> - 3.4.5.2-9.UNBUILT
 - Resolves: rhbz#770209 can't change paper tray setting while printing
+- Resolves: rhbz#789022 SwNodes: fix inconsistent outline check
 
 * Tue Mar 06 2012 Caolán McNamara <caolanm at redhat.com> - 3.4.5.2-8
 - Resolves: fdo#31966 do not create an empty slide when printing handouts


More information about the scm-commits mailing list