From d2322b8e0b91bb24a60faf7241c0096970e38cbc Mon Sep 17 00:00:00 2001 From: FredKiefer Date: Sun, 15 Oct 2000 20:55:38 +0000 Subject: [PATCH] Improved the memory handling in diverse methods. git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@7821 72102866-910b-0410-8b05-ffd578937521 --- Source/Parsers/attributedStringConsumer.m | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/Source/Parsers/attributedStringConsumer.m b/Source/Parsers/attributedStringConsumer.m index 57eb23437..99fe75948 100644 --- a/Source/Parsers/attributedStringConsumer.m +++ b/Source/Parsers/attributedStringConsumer.m @@ -102,7 +102,9 @@ readNSString(StringContext *ctxt) RTFAttribute *new = (RTFAttribute *)NSCopyObject (self, 0, zone); new->paragraph = [paragraph copyWithZone: zone]; - new->fontName = [fontName copyWithZone: zone]; + RETAIN(new->fontName); + RETAIN(new->fgColour); + RETAIN(new->bgColour); return new; } @@ -304,6 +306,7 @@ readNSString(StringContext *ctxt) ASSIGN(attrs, [NSMutableArray array]); ASSIGN(colours, [NSMutableArray array]); [attrs addObject: attr]; + RELEASE(attr); } - (RTFAttribute*) attr @@ -313,7 +316,10 @@ readNSString(StringContext *ctxt) - (void) push { - [attrs addObject: [[attrs lastObject] copy]]; + RTFAttribute *attr = [[attrs lastObject] copy]; + + [attrs addObject: attr]; + RELEASE(attr); } - (void) pop @@ -351,6 +357,7 @@ readNSString(StringContext *ctxt) //[localException raise]; NS_ENDHANDLER + RELEASE(rtfString); RELEASE(pool); // document attributes if (dict)