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

Petr Mladek pmladek at kemper.freedesktop.org
Fri Mar 18 09:44:55 PDT 2011


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

New commits:
commit d1234b1bcd542b4ce523b6be76e7491afdce4de8
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Fri Mar 18 12:29:41 2011 +0000

    Resolves: fdo#32553 freeze/hang on mailmerge to attached pdf
    
    Signed-off-by: Petr Mladek <pmladek at suse.cz>

diff --git a/sw/source/core/docnode/nodes.cxx b/sw/source/core/docnode/nodes.cxx
index e47a094..b44c285 100644
--- a/sw/source/core/docnode/nodes.cxx
+++ b/sw/source/core/docnode/nodes.cxx
@@ -2108,9 +2108,13 @@ void SwNodes::_CopyNodes( const SwNodeRange& rRange,
                     pDoc->GetNodes().GetEndOfInserts().StartOfSectionIndex()
                     < aInsPos.GetIndex() )
             {
-                nNodeCnt -=
+                ULONG nDistance =
                     ( pAktNode->EndOfSectionIndex() -
                         aRg.aStart.GetIndex() );
+                if (nDistance < nNodeCnt)
+                    nNodeCnt -= nDistance;
+                else
+                    nNodeCnt = 1;
 
                 // dann alle Nodes der Tabelle in die akt. Zelle kopieren
                 // fuer den TabellenNode einen DummyNode einfuegen?
@@ -2145,7 +2149,11 @@ void SwNodes::_CopyNodes( const SwNodeRange& rRange,
                 SwNodeIndex nStt( aInsPos, -1 );
                 SwTableNode* pTblNd = ((SwTableNode*)pAktNode)->
                                         MakeCopy( pDoc, aInsPos );
-                nNodeCnt -= aInsPos.GetIndex() - nStt.GetIndex() -2;
+                ULONG nDistance = aInsPos.GetIndex() - nStt.GetIndex() - 2;
+                if (nDistance < nNodeCnt)
+                    nNodeCnt -= nDistance;
+                else
+                    nNodeCnt = 1;
 
                 aRg.aStart = pAktNode->EndOfSectionIndex();
 
@@ -2169,7 +2177,11 @@ void SwNodes::_CopyNodes( const SwNodeRange& rRange,
                 SwSectionNode* pSectNd = ((SwSectionNode*)pAktNode)->
                                     MakeCopy( pDoc, aInsPos );
 
-                nNodeCnt -= aInsPos.GetIndex() - nStt.GetIndex() -2;
+                ULONG nDistance = aInsPos.GetIndex() - nStt.GetIndex() - 2;
+                if (nDistance < nNodeCnt)
+                    nNodeCnt -= nDistance;
+                else
+                    nNodeCnt = 1;
                 aRg.aStart = pAktNode->EndOfSectionIndex();
 
                 if( bNewFrms && pSectNd &&


More information about the Libreoffice-commits mailing list