Copy contents before setting it [setObjectValue]

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@34584 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
rmottola 2012-01-19 00:40:47 +00:00
parent 0b99ca07c2
commit 28d954f7cd
2 changed files with 10 additions and 5 deletions

View file

@ -1,3 +1,8 @@
2012-01-19 Riccardo Mottola <rm@gnu.org>
*Source/NSCell.m:
Copy contents before setting it [setObjectValue]
2012-01-18 Fred Kiefer <FredKiefer@gmx.de> 2012-01-18 Fred Kiefer <FredKiefer@gmx.de>
* Headers/AppKit/NSImageView.h, * Headers/AppKit/NSImageView.h,

View file

@ -2,7 +2,7 @@
<abstract>The abstract cell class</abstract> <abstract>The abstract cell class</abstract>
Copyright (C) 1996 Free Software Foundation, Inc. Copyright (C) 1996-2012 Free Software Foundation, Inc.
Author: Scott Christley <scottc@net-community.com> Author: Scott Christley <scottc@net-community.com>
Date: 1996 Date: 1996
@ -342,19 +342,19 @@ static NSColor *dtxtCol;
{ {
if (object == nil || [object isKindOfClass: [NSString class]] == YES) if (object == nil || [object isKindOfClass: [NSString class]] == YES)
{ {
newContents = object; newContents = [object copy];
_cell.contents_is_attributed_string = NO; _cell.contents_is_attributed_string = NO;
_cell.has_valid_object_value = YES; _cell.has_valid_object_value = YES;
} }
else if ([object isKindOfClass: [NSAttributedString class]] == YES) else if ([object isKindOfClass: [NSAttributedString class]] == YES)
{ {
newContents = object; newContents = [object copy];
_cell.contents_is_attributed_string = YES; _cell.contents_is_attributed_string = YES;
_cell.has_valid_object_value = YES; _cell.has_valid_object_value = YES;
} }
else if ([_object_value respondsToSelector: @selector(attributedStringValue)]) else if ([_object_value respondsToSelector: @selector(attributedStringValue)])
{ {
newContents = [_object_value attributedStringValue]; newContents = [[_object_value attributedStringValue] copy]; //is this copy necessary?
_cell.contents_is_attributed_string = YES; _cell.contents_is_attributed_string = YES;
_cell.has_valid_object_value = 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 // If the thing that was assigned is not a string, but
// responds to stringValue then get that. // responds to stringValue then get that.
newContents = [_object_value stringValue]; newContents = [[_object_value stringValue] copy]; //is this copy necessary?
_cell.contents_is_attributed_string = NO; _cell.contents_is_attributed_string = NO;
_cell.has_valid_object_value = YES; _cell.has_valid_object_value = YES;
} }