Re: Leopard Crashing in Open and Save Panels (solved?)
Re: Leopard Crashing in Open and Save Panels (solved?)
- Subject: Re: Leopard Crashing in Open and Save Panels (solved?)
- From: John Stiles <email@hidden>
- Date: Tue, 04 Dec 2007 14:00:40 -0800
Actually, hmm, I don't know if my idea will work because you're not
allocating a save panel, you're getting it from -savePanel.
Maybe you could put a category on NSSavePanel and add your -release and
-autorelease in there? (This assumes that NSSavePanel doesn't already
override -release and -autorelease, but I think that's an OK assumption
for debugging purposes—just don't ship code that way.)
John Stiles wrote:
I'd think that we'd have seen it occur in many other apps already if
there wasn't something else going on here.
Have you tried making a subclass of NSSavePanel, overriding -release
and -autorelease and then putting breakpoints in it? (And call [super
release] or [super autorelease] to actually get it to release.) That
can tell you who is doing the extra release.
John Nairn wrote:
The following method would crash frequently in Leopard although it
never crashed in past 5 years before Leopard.
// save copy to results file
- (IBAction)exportXMLCommands:(id)sender
{
NSSavePanel *pan = [NSSavePanel savePanel];
[pan beginSheetForDirectory:nil file:nil
modalForWindow:[self window] modalDelegate:self
didEndSelector:@selector(exportXMLPanelDidEnd:returnCode:contextInfo:)
contextInfo:nil];
}
// if OK, sav text in new file
- (void)exportXMLPanelDidEnd:(NSSavePanel *)sheet
returnCode:(int)returnCode
contextInfo:(void *)contextInfo
{
}
It would crash in the NSSavePanel method soon after the sheet opened
and before returning to my code.
The crashes have stopped by retaining the panel in the first method
NSSavePanel *pan = [[NSSavePanel savePanel] retain];
and releasing when the sheet is finished.
[sheet release];
I am wondering if the new garbage collection in Leopard has caused
this problem? My project is set to "unsupported" for garbage collect,
but does that stop Cocoa objects themselves from using it?
Furthermore, I have seen crashes in the open panel which is handled
entirely by the NSDocument class. Since there is no panel for me to
retain, what would be a good solution for those crashes?
---------------
John Nairn (1-541-737-4265, FAX:1-541-737-3385)
Professor and Richardson Chair
Web Page: http://woodscience.oregonstate.edu/faculty/Nairn
FEA/MPM Web Page: http://oregonstate.edu/~nairnj
_______________________________________________
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