bug-gnustep
[Top][All Lists]
Advanced

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

[sr #106637] NSSavePanel/NSOpenPanel return an instance variable instead


From: Riccardo mottola
Subject: [sr #106637] NSSavePanel/NSOpenPanel return an instance variable instead of object copy
Date: Thu, 12 Feb 2009 23:33:59 +0000
User-agent: Mozilla/5.0 (Macintosh; U; PPC Mac OS X; en) AppleWebKit/312.9 (KHTML, like Gecko) Safari/312.6

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/





reply via email to

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