Re: EXC_BAD_ACCESS when calling NSOpenPanel
Re: EXC_BAD_ACCESS when calling NSOpenPanel
- Subject: Re: EXC_BAD_ACCESS when calling NSOpenPanel
- From: Darren Wheatley <email@hidden>
- Date: Tue, 24 Nov 2009 00:57:38 +0000
The only difference between the two machines is that the working machine
has DefaultFolderX installed on it.
As a test I installed Default Folder X on the MBP as well. The code now
runs without error.
So, why would Default Folder X be masking the problem (it overloads the
file open/save dialog to add functionality such as favourite folders)?
Cheers
Darren.
On 24/11/2009 00:51, Darren Wheatley wrote:
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
_______________________________________________
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