summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2011-03-18 12:29:41 +0000
committerCaolán McNamara <caolanm@redhat.com>2011-03-18 12:29:41 +0000
commit7482695994c5f6bf9995748944e38d2792aaed92 (patch)
treecc50f651147687439fba0f82a1b8ab303b0629d2
parent1cb177f424942549b547c2113129d607dec3c1e5 (diff)
Resolves: fdo#32553 freeze/hang on mailmerge to attached pdf
-rw-r--r--sw/source/core/docnode/nodes.cxx18
1 files changed, 15 insertions, 3 deletions
diff --git a/sw/source/core/docnode/nodes.cxx b/sw/source/core/docnode/nodes.cxx
index 6d0e35061d..491e948f21 100644
--- a/sw/source/core/docnode/nodes.cxx
+++ b/sw/source/core/docnode/nodes.cxx
@@ -1999,9 +1999,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?
@@ -2036,7 +2040,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();
@@ -2060,7 +2068,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 &&