• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
EXC_BAD_ACCESS when calling NSOpenPanel
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

EXC_BAD_ACCESS when calling NSOpenPanel


  • Subject: EXC_BAD_ACCESS when calling NSOpenPanel
  • From: Darren Wheatley <email@hidden>
  • Date: Tue, 24 Nov 2009 00:51:54 +0000

Hi,

I have the following code as the action from a button click:

- (IBAction)chooseFile:(id)sender;
{
NSOpenPanel *openPanel = [NSOpenPanel openPanel];
[openPanel setCanChooseDirectories:NO];
[openPanel setCanCreateDirectories:NO];
[openPanel beginSheetForDirectory:nil
file:nil
types:[NSArray arrayWithObject:@"txt"]
modalForWindow:window
modalDelegate:self
didEndSelector:@selector(fileOpenDidEnd:returnCode:context:)
contextInfo:nil];
}


- (void)fileOpenDidEnd:(NSOpenPanel*)openPanel
            returnCode:(NSInteger)code
               context:(void*)context
{
    if (code == NSCancelButton) return;
    [self setFilePath:[openPanel filename]];
    [filePathField setStringValue:[openPanel filename]];
}

On my 10.6.2 iMac running XCode 3.2.1 it builds and runs fine. On my MacBook Pro with exactly the same OS version (10.6.2) and XCode version I get a crash - EXC_BAD_ACCESS when I run it.

The file open dialog pops up for a second but then disappears before I can click on anything.

The fileOpenDidEnd method does not get called.

Any idea why identical code built with the same version of XCode running on the same version of Snow Leopard works on one machine and crashes on another? Both are clean builds of Snow Leopard rather than upgrades.

Regards

Darren.


_______________________________________________

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


  • Follow-Ups:
    • Re: EXC_BAD_ACCESS when calling NSOpenPanel
      • From: Ken Thomases <email@hidden>
    • Re: EXC_BAD_ACCESS when calling NSOpenPanel
      • From: Graham Cox <email@hidden>
    • Re: EXC_BAD_ACCESS when calling NSOpenPanel
      • From: Jens Alfke <email@hidden>
    • Re: EXC_BAD_ACCESS when calling NSOpenPanel
      • From: Darren Wheatley <email@hidden>
  • Prev by Date: Re: Strings mangled on generalPasteboard
  • Next by Date: Re: EXC_BAD_ACCESS when calling NSOpenPanel
  • Previous by thread: ANN: CamelBones 1.1.0
  • Next by thread: Re: EXC_BAD_ACCESS when calling NSOpenPanel
  • Index(es):
    • Date
    • Thread