From 1aa8a3739a75427434074212745d7ffedf56b5a9 Mon Sep 17 00:00:00 2001 From: Martin Gallwey Date: Fri, 2 Mar 2001 10:24:50 +0000 Subject: fix a memory leak --- sw/source/core/unocore/unoidx.cxx | 25 ++++++++++--------------- 1 file changed, 10 insertions(+), 15 deletions(-) (limited to 'sw') diff --git a/sw/source/core/unocore/unoidx.cxx b/sw/source/core/unocore/unoidx.cxx index 21a50a4a04b1..2b40fd1f469d 100644 --- a/sw/source/core/unocore/unoidx.cxx +++ b/sw/source/core/unocore/unoidx.cxx @@ -2,9 +2,9 @@ * * $RCSfile: unoidx.cxx,v $ * - * $Revision: 1.24 $ + * $Revision: 1.25 $ * - * last change: $Author: os $ $Date: 2001-02-15 13:46:37 $ + * last change: $Author: mtg $ $Date: 2001-03-02 11:24:41 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -1419,11 +1419,6 @@ void SwXDocumentIndexMark::attachToRange(const Reference< text::XTextRange > & x break; } } - if(!pTOXType) - { - SwTOXType aUserType(TOX_USER, sUserIndexName); - pTOXType = pDoc->InsertTOXType(aUserType); - } } } break; @@ -1436,29 +1431,29 @@ void SwXDocumentIndexMark::attachToRange(const Reference< text::XTextRange > & x SwUnoInternalPaM aPam(*pDoc); //das muss jetzt sal_True liefern SwXTextRange::XTextRangeToSwPaM(aPam, xTextRange); - SwTOXMark* pMark = new SwTOXMark(pTOXType); + SwTOXMark aMark (pTOXType); if(sAltText.Len()) - pMark->SetAlternativeText(sAltText); + aMark.SetAlternativeText(sAltText); switch(eType) { case TOX_INDEX: if(sPrimaryKey.Len()) - pMark->SetPrimaryKey(sPrimaryKey); + aMark.SetPrimaryKey(sPrimaryKey); if(sSecondaryKey.Len()) - pMark->SetSecondaryKey(sSecondaryKey); + aMark.SetSecondaryKey(sSecondaryKey); break; case TOX_CONTENT: if(USHRT_MAX != nLevel) - pMark->SetLevel(nLevel); + aMark.SetLevel(nLevel); break; } UnoActionContext aAction(pDoc); sal_Bool bMark = *aPam.GetPoint() != *aPam.GetMark(); // Marks ohne Alternativtext ohne selektierten Text koennen nicht eingefuegt werden, // deshalb hier ein Leerzeichen - ob das die ideale Loesung ist? - if(!bMark && !pMark->GetAlternativeText().Len()) - pMark->SetAlternativeText(String::CreateFromAscii(" ")); - pDoc->Insert(aPam, *pMark, SETATTR_DONTEXPAND); + if(!bMark && !aMark.GetAlternativeText().Len()) + aMark.SetAlternativeText(String::CreateFromAscii(" ")); + pDoc->Insert(aPam, aMark, SETATTR_DONTEXPAND); if(bMark && *aPam.GetPoint() > *aPam.GetMark()) aPam.Exchange(); SwUnoCrsr* pCrsr = pDoc->CreateUnoCrsr( *aPam.Start() ); -- cgit v1.2.3