* Source/NSCell.m (-setStringValue:, setObjectValue:): Always use

ASSIGNCOPY for the contents. This fixes memory leak of last commit.


git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@34585 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Fred Kiefer 2012-01-19 08:47:52 +00:00
parent 9603f29b84
commit ace1561e52
2 changed files with 12 additions and 6 deletions

View file

@ -1,3 +1,9 @@
2012-01-19 Fred Kiefer <FredKiefer@gmx.de>
* Source/NSCell.m (-setStringValue:, setObjectValue:): Always use
ASSIGNCOPY for the contents. This fixes memory leak of last
commit.
2012-01-19 Riccardo Mottola <rm@gnu.org>
*Source/NSCell.m:

View file

@ -342,19 +342,19 @@ static NSColor *dtxtCol;
{
if (object == nil || [object isKindOfClass: [NSString class]] == YES)
{
newContents = [object copy];
newContents = object;
_cell.contents_is_attributed_string = NO;
_cell.has_valid_object_value = YES;
}
else if ([object isKindOfClass: [NSAttributedString class]] == YES)
{
newContents = [object copy];
newContents = object;
_cell.contents_is_attributed_string = YES;
_cell.has_valid_object_value = YES;
}
else if ([_object_value respondsToSelector: @selector(attributedStringValue)])
{
newContents = [[_object_value attributedStringValue] copy]; //is this copy necessary?
newContents = [_object_value attributedStringValue];
_cell.contents_is_attributed_string = YES;
_cell.has_valid_object_value = YES;
}
@ -362,7 +362,7 @@ static NSColor *dtxtCol;
{
// If the thing that was assigned is not a string, but
// responds to stringValue then get that.
newContents = [[_object_value stringValue] copy]; //is this copy necessary?
newContents = [_object_value stringValue];
_cell.contents_is_attributed_string = NO;
_cell.has_valid_object_value = YES;
}
@ -387,7 +387,7 @@ static NSColor *dtxtCol;
}
}
ASSIGN (_contents, newContents);
ASSIGNCOPY(_contents, newContents);
}
@ -484,7 +484,7 @@ static NSColor *dtxtCol;
}
else
{
ASSIGN (_contents, aString);
ASSIGNCOPY(_contents, aString);
_cell.contents_is_attributed_string = NO;
_cell.has_valid_object_value = NO;
}