Re: Crash With Toolbar Items
Re: Crash With Toolbar Items
- Subject: Re: Crash With Toolbar Items
- From: Nick Zitzmann <email@hidden>
- Date: Thu, 31 Jul 2003 13:13:25 -0700
On Thursday, July 31, 2003, at 12:21 PM, Seth Willits wrote:
I setup a window controller subclass and used the code below to setup
a very basic toolbar but when I run the application, the window shows,
I see the customize toolbar item in the window and about half a second
later the app crashes. I'm not sure what's causing it to crash, but if
I don't call setupToolbar it doesn't crash. I've stepped through with
the debugger and it doesn't crash in this code but somewhere in
NSWindowController showWindow.
[...]
- (void)setupToolbar
{
NSToolbar *toolbar = [[NSToolbar alloc]
initWithIdentifier:@"mainToolbar"];
[toolbar autorelease];
[toolbar setDelegate:self];
[toolbar setAllowsUserCustomization:YES];
[toolbar setAutosavesConfiguration:YES];
[[self window] setToolbar:[toolbar autorelease]];
}
I suspect it's because you're autoreleasing the toolbar twice. Try
changing that last line to this:
[[self window] setToolbar:toolbar];
Nick Zitzmann
AIM/iChat: dragonsdontsleep
Check out my software page:
http://seiryu.home.comcast.net/
"I have always wished that my computer would be as easy to use as my
telephone. My wish has come true. I no longer know how to use my
telephone." - Bjarne Stroustrup
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.