[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[bug #25572] NSSavePanel/NSOpenPanel return an instance variable instead
From: |
Fred Kiefer |
Subject: |
[bug #25572] NSSavePanel/NSOpenPanel return an instance variable instead of object copy |
Date: |
Sat, 14 Feb 2009 21:43:55 +0000 |
User-agent: |
Mozilla/5.0 (compatible; Konqueror/3.5; Linux) KHTML/3.5.10 (like Gecko) SUSE |
Follow-up Comment #1, bug #25572 (project gnustep):
GNUstep really should be doing more copying when setting or returning
instance variables. This is out of question. Your specific solution may not
the the most efficient one. I will probably replace
return [NSString stringWithString:_directory];
with
return AUTORELEASE([_directory copy]);
Here immutable subclasses of NSString may decide to not copy themselves and
in your case a new object is created every time.
On the other hand your application is also at fault, it relies on the fact
that an object returned by a method will stay around. This is never
guarrantied, you always need to retain objects yourself, when you need to use
them later on.
_______________________________________________________
Reply to this item at:
<http://savannah.gnu.org/bugs/?25572>
_______________________________________________
Nachricht geschickt von/durch Savannah
http://savannah.gnu.org/