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 (Cocoa-dev@lists.apple.com)

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 arch...@mail-archive.com

Reply via email to