views:

171

answers:

1

I tried this but my program crashed.

- (void)windowWillClose:(NSNotification *)notification
{
    [modalWindow orderOut:self];
    [NSApp stopModal];
}

Thanks in advance.

+1  A: 

Most likely, modalWindow is not pointing to a valid object. That's the only obvious thing that would crash in those two lines. You should be able to use the debugger to find out more about why it's crashing before asking for help.

Ken Aspeslagh
Specifically, it is pointing to an invalid (deceased) object. `nil` isn't a valid object, either, but sending a message to it will not cause a crash.
Peter Hosey
I unchecked "Release When Closed" option on Interface Builder then it's running fine.Thanks.
Irwan