Re: Toolbar customizer crashes on Leopard when using menu delegate
Re: Toolbar customizer crashes on Leopard when using menu delegate
- Subject: Re: Toolbar customizer crashes on Leopard when using menu delegate
- From: Markus Spoettl <email@hidden>
- Date: Thu, 25 Mar 2010 12:10:29 -0400
Hi Peter,
On Mar 24, 2010, at 11:13 PM, Peter Ammon wrote:
> Yes, this is a known problem on Leopard. The issue is that when NSToolbar shows the customization palette, well, a view can't be in the toolbar and the customization palette simultaneously, so NSToolbar "copies" the popup via NSKeyedArchiver. Unfortunately, NSMenu's encodeWithCoder: method encodes its delegate unconditionally, and if the delegate doesn't implement NSCoding, you get an exception.
>
> In SnowLeopard, NSToolbar was revamped to render the views into images and show the images - not the views - in the customization palette. So NSToolbar in SnowLeopard no longer "copies" views, which is why the problem does not reproduce.
>
> I think the easiest workaround is to implement NSCoding on your NSMenu delegate. The delegate doesn't have to do a very good job encoding itself, because the delegate will not actually be used in the customization palette. In fact, you may be able to get away with implementing replacementObjectForCoder: on your delegate to just return nil.
Thanks a lot for the detailed explanation. Something else must be playing into this because my delegate is an NSWindowController subclass which already conforms to the NSCoding protocol. A second instance actually gets created during the customizer setup, but it's dealloc'd before the crash happens.
Regards
Markus
--
__________________________________________
Markus Spoettl
Attachment:
smime.p7s
Description: S/MIME cryptographic signature
_______________________________________________
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