Crashes with NSOpenPanel and garbage collection
Crashes with NSOpenPanel and garbage collection
- Subject: Crashes with NSOpenPanel and garbage collection
- From: Daniel Parnell <email@hidden>
- Date: Fri, 9 May 2008 12:12:00 +1000
Hi All,
I'm having an interesting problem. I'm trying to use NSOpenPanel
to select some files (as one usually does), however if I compile with
garbage collection on and then try to use the Music, Photos or Movies
areas in the open panel I get very strange crashes. If I've
previously opened a file from one of these areas and the open panel is
now defaulting to them then simply using Command-O will also cause the
same crash.
Is there some special magic I need to use to allow me to use
NSOpenPanel and the special Photo, Music and Movies areas with garbage
collection turned on?
I'm able to replicate this crash in a simple little app I threw
together containing the following code.
- (IBAction) doIt:(id)sender {
NSOpenPanel* panel = [NSOpenPanel openPanel];
[panel setAllowsMultipleSelection: YES];
[panel setPrompt: NSLocalizedString(@"Insert", @"Insert Prompt")];
[panel setAllowedFileTypes: [NSImage imageTypes]];
[panel beginSheetForDirectory: nil file: nil modalForWindow: window
modalDelegate: self
didEndSelector:@selector(insertPanelDidEnd:returnCode:contextInfo:)
contextInfo: nil];
}
- (void)insertPanelDidEnd:(NSOpenPanel *)panel returnCode:
(int)returnCode contextInfo:(void *)contextInfo {
if(returnCode==NSOKButton) {
NSLog(@"got files=%@", [panel filenames]);
}
}
Daniel
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden