URL: <http://savannah.gnu.org/support/?106637>
Summary: NSSavePanel/NSOpenPanel return an instance variable instead of object copy Project: GNUstep Submitted by: rmottola Submitted on: Thu 12 Feb 2009 11:33:58 PM GMT Category: AppKit Priority: 5 - Normal Severity: 3 - Normal Status: None Privacy: Public Assigned to: None Originator Email: Open/Closed: Open Discussion Lock: Any Operating System: None _______________________________________________________ Details: debugging the reason of easydiff Crashing while opening the second file to compare, I traced it to a problem with [NSSavePanel directory]. That method returns just the instance variable _directory. Since the second time the shared instance of the panel is gotten the internal variable gets ASSIGNed, the original object returned the first time gets released, and thus gets invalid. even if this could be worked around in several ways in the applicatioin, I consider ths behaviour unexpected. I thus run the following test on the mac: { NSOpenPanel *panel; NSString *dir; panel = [NSOpenPanel openPanel]; dir = nil; [panel runModalForDirectory: dir file:nil types:nil]; dir = [panel directory]; panel = [NSOpenPanel openPanel]; [panel runModalForDirectory: dir file:nil types:nil]; NSLog(@"dir: %@", dir); NSLog(@"file: %@", [[panel filenames] objectAtIndex:0]); } and it works fine. thus I think gnustep should return an autoreleaed copy of the directory string. _______________________________________________________ Reply to this item at: <http://savannah.gnu.org/support/?106637> _______________________________________________ Message sent via/by Savannah http://savannah.gnu.org/ _______________________________________________ Bug-gnustep mailing list Bug-gnustep@gnu.org http://lists.gnu.org/mailman/listinfo/bug-gnustep