Minor retain/release fix

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@6637 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
richard 2000-06-03 04:47:10 +00:00
parent 620dfcfa5b
commit ef98c0cf61
2 changed files with 46 additions and 29 deletions

View file

@ -1,3 +1,8 @@
2000-06-03 Richard Frith-Macdonald <rfm@gnu.org>
* Source/NSAttributedString.m: ([-setAlignment:range:]) retain/release
problem fixed.
Thu Jun 1 21:50:34 2000 Nicola Pero <nicola@brainstorm.co.uk> Thu Jun 1 21:50:34 2000 Nicola Pero <nicola@brainstorm.co.uk>
* Source/NSScrollView.m ([NSScrollView -tile]): Fixed position of * Source/NSScrollView.m ([NSScrollView -tile]): Fixed position of

View file

@ -177,7 +177,7 @@ paraBreakCSet()
atIndex: range.location atIndex: range.location
effectiveRange: &range]; effectiveRange: &range];
if (style) if (style != nil)
{ {
return [NSDictionary dictionaryWithObject: style return [NSDictionary dictionaryWithObject: style
forKey: NSParagraphStyleAttributeName]; forKey: NSParagraphStyleAttributeName];
@ -550,7 +550,6 @@ documentAttributes: (NSDictionary**)dict
{ {
id value; id value;
unsigned loc = range.location; unsigned loc = range.location;
NSRange effRange;
if (range.location < 0 || NSMaxRange(range) > [self length]) if (range.location < 0 || NSMaxRange(range) > [self length])
{ {
@ -560,20 +559,34 @@ documentAttributes: (NSDictionary**)dict
while (loc < NSMaxRange(range)) while (loc < NSMaxRange(range))
{ {
BOOL copiedStyle = NO;
NSRange effRange;
NSRange newRange;
value = [self attribute: NSParagraphStyleAttributeName value = [self attribute: NSParagraphStyleAttributeName
atIndex: loc atIndex: loc
effectiveRange: &effRange]; effectiveRange: &effRange];
newRange = NSIntersectionRange(effRange, range);
if (value == nil) if (value == nil)
{
value = [NSMutableParagraphStyle defaultParagraphStyle]; value = [NSMutableParagraphStyle defaultParagraphStyle];
}
else else
{
value = [value mutableCopy]; value = [value mutableCopy];
copiedStyle = YES;
}
[value setAlignment: alignment]; [value setAlignment: alignment];
[self addAttribute: NSParagraphStyleAttributeName [self addAttribute: NSParagraphStyleAttributeName
value: value value: value
range: NSIntersectionRange(effRange, range)]; range: newRange];
if (copiedStyle == YES)
{
RELEASE(value);
}
loc = NSMaxRange(effRange); loc = NSMaxRange(effRange);
} }
} }
@ -592,7 +605,6 @@ documentAttributes: (NSDictionary**)dict
[NSException raise: NSRangeException [NSException raise: NSRangeException
format: @"RangeError in method -fixFontAttributeInRange:"]; format: @"RangeError in method -fixFontAttributeInRange:"];
} }
} }
- (void) fixParagraphStyleAttributeInRange: (NSRange)range - (void) fixParagraphStyleAttributeInRange: (NSRange)range