On 10/15/09 6:34 AM, Timothy Stafford Larkin said:

>I messed around with this problem for some time, before I gave up
>trying to be clever and cast the pointer as an unsigned long.
>
>               NSNumber *p = [NSNumber numberWithUnsignedLong:(unsigned 
> long)object];
>
>The number can be added to a pasteboard. Or if dragging more than one
>object, NSNumbers can be added to an NSArray, and the array written to
>the pasteboard.

That seems quite dangerous, especially in a GC app.  Creating such an
NSNumber will not keep a strong reference to "object", and so it risks
getting prematurely collected.  If you do do this, better CFRetain the
object first.

--
____________________________________________________________
Sean McBride, B. Eng                 s...@rogue-research.com
Rogue Research                        www.rogue-research.com
Mac Software Developer              Montréal, Québec, Canada


_______________________________________________

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