gnustep-dev
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: textview / test storage string copy problem


From: Riccardo Mottola
Subject: Re: textview / test storage string copy problem
Date: Wed, 18 Jan 2012 12:57:45 +0100
User-agent: Mozilla/5.0 (X11; Linux i686; rv:8.0) Gecko/20120104 Icedove/8.0

Hi,

On 01/18/2012 11:20 AM, Dr. H. Nikolaus Schaller wrote:
Here:

http://www.gnustep.org/resources/OpenStepSpec/ApplicationKit/Classes/NSCell.html

	• - (void)setStringValue:(NSString *)aString	Sets the NSCell's value to a copy of aString.

So you should find out why it does not set the value to a copy.
Ok, maybe my patch is wrong, I can take it out. The problem could be indeed NSCell.. I see it does:

line 335

  id newContents;
 
  ASSIGN (_object_value, object);
 
  if (_formatter == nil)
    {
      if (object == nil || [object isKindOfClass: [NSString class]] == YES)
        {
          newContents = object;
          _cell.contents_is_attributed_string = NO;
          _cell.has_valid_object_value = YES;
        }
<....>

  ASSIGN (_contents, newContents);


I see no "copy" method here, perhaps the fix is as simple as
newContents = [NSString stringWithString: (NSString*)object)];


stringWithString should be fine if our own gnustep doc is correct:

+ (id) stringWithString: (NSString*)aString;
Availability: MacOS-X 10.0.0

Create a copy of aString.

Riccardo


reply via email to

[Prev in Thread] Current Thread [Next in Thread]