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 protected])

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [email protected]

Reply via email to