[Mono-bugs] [Bug 656745] Setting an NSTableColumn Cell to a NSButtonCell causes an error

bugzilla_noreply at novell.com bugzilla_noreply at novell.com
Wed Dec 1 21:33:07 EST 2010


https://bugzilla.novell.com/show_bug.cgi?id=656745

https://bugzilla.novell.com/show_bug.cgi?id=656745#c1


Geoff Norton <gnorton at novell.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |miguel at novell.com

--- Comment #1 from Geoff Norton <gnorton at novell.com> 2010-12-02 02:33:05 UTC ---
This is a bit of an odd case, first it appears you did not read:

http://developer.apple.com/library/mac/#documentation/Cocoa/Conceptual/ControlCell/Tasks/SubclassingNSCell.html

The relevant sections:

The initImageCell: method is the designated initializer for NSCells that
display images. The initTextCell: method is the designated initializer for
NSCells that display text. Override one or both of these methods if you
implement a subclass of NSCell that performs its own initialization. If you
need to use target and action behavior, you may prefer to subclass NSActionCell
or one of its subclasses, which provide the default implementation of this
behavior.

and more specifically for this case:

If the subclass contains instance variables that hold pointers to objects,
consider overriding copyWithZone: to duplicate the objects. The default version
copies only pointers to the objects.

So what was happening here is ObjC was calling

[yourcell copyWithZone: nil]

It was then sending a retain to the copy'd cell, but since we never constructed
it in managed land (either thru activation or a constructor or any other chain)
we had no knowledge of it, so we tried to call DataGridViewCheckBoxCell(IntPtr)
to activate the managed proxy.

I need to think about how we can make consuming this API easier on all of our
users, perhaps we can come up with some NSCopying -> ICloneable pattern.

CC miguel

-- 
Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the QA contact for the bug.


More information about the mono-bugs mailing list