summaryrefslogtreecommitdiff
path: root/sw
diff options
context:
space:
mode:
authorStephan Bergmann <sbergman@redhat.com>2013-08-13 18:13:49 +0200
committerCaolán McNamara <caolanm@redhat.com>2013-08-14 09:03:33 +0000
commitb1b99974960259bd721f381723f74b1c00e034bb (patch)
treefbc620c66cd84ab381fd3b1284ef164044ec6b0b /sw
parent0178c9ec0a2543c3713907f51911a05e31567db1 (diff)
fdo#68064: Do not insert aTempEntry multiple times
...and do not let it go out of scope before being used in BigPtrArray::Remove. (And, en passant, avoid use of reserved identifier, starting with an underscore followed by a capital letter.) Change-Id: Ic5730f707601a2070f2eed3ba017650026657df3 (cherry picked from commit ebc81f19ef4ffe8d54f83c019ea80d10c98647d7) Reviewed-on: https://gerrit.libreoffice.org/5406 Reviewed-by: Caolán McNamara <caolanm@redhat.com> Tested-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'sw')
-rw-r--r--sw/source/core/docnode/nodes.cxx12
1 files changed, 8 insertions, 4 deletions
diff --git a/sw/source/core/docnode/nodes.cxx b/sw/source/core/docnode/nodes.cxx
index 543aa24d1f76..89be73e2a81d 100644
--- a/sw/source/core/docnode/nodes.cxx
+++ b/sw/source/core/docnode/nodes.cxx
@@ -2326,11 +2326,14 @@ void SwNodes::ForEach( const SwNodeIndex& rStart, const SwNodeIndex& rEnd,
(FnForEach) fnForEach, pArgs );
}
-struct _TempBigPtrEntry : public BigPtrEntry
+namespace {
+
+struct TempBigPtrEntry : public BigPtrEntry
{
- _TempBigPtrEntry() {}
+ TempBigPtrEntry() {}
};
+}
void SwNodes::RemoveNode( sal_uLong nDelPos, sal_uLong nSz, sal_Bool bDel )
{
@@ -2374,6 +2377,7 @@ void SwNodes::RemoveNode( sal_uLong nDelPos, sal_uLong nSz, sal_Bool bDel )
}
}
+ std::vector<TempBigPtrEntry> aTempEntries;
if( bDel )
{
sal_uLong nCnt = nSz;
@@ -2386,14 +2390,14 @@ void SwNodes::RemoveNode( sal_uLong nDelPos, sal_uLong nSz, sal_Bool bDel )
// ablaueft, wird hier ein temp. Objekt eingefuegt, das
// dann mit dem Remove wieder entfernt wird.
// siehe Bug 55406
- _TempBigPtrEntry aTempEntry;
- BigPtrEntry* pTempEntry = &aTempEntry;
+ aTempEntries.resize(nCnt);
while( nCnt-- )
{
delete pDel;
pDel = pPrev;
sal_uLong nPrevNdIdx = pPrev->GetIndex();
+ BigPtrEntry* pTempEntry = &aTempEntries[nCnt];
BigPtrArray::Replace( nPrevNdIdx+1, pTempEntry );
if( nCnt )
pPrev = (*this)[ nPrevNdIdx - 1 ];