> On Nov 7, 2016, at 10:46 AM, Richard Charles <rcharles...@gmail.com> wrote:
> 
>    [doc performSelector:@selector(updateChangeCount:)
>              withObject:@(NSChangeUndone)
>              afterDelay:0];

That one definitely won’t work. The parameter to updateChangeCount: is an 
integer (enum) value, not an object reference, but you’re calling it with an 
NSNumber object. The value actually passed to the method will be a garbage 
value based on the raw address* of the NSNumber object.

If you want to use a delayed-perform to call a method that takes a non-object 
parameter, you have to create a new method that makes the call you want, then 
invoke _that_ method using a delayed perform. (Or you could just do things the 
modern way, with dispatch_async and a block.)

—Jens

* I’m aware that small integers don’t turn into real NSNumber objects on the 
heap, rather a tagged pointer, but the result is the same: a pointer that will 
result in a garbage value when interpreted as an integer.
_______________________________________________

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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to