Hi!

> In the document object, I am observing such an event, then creating a handler 
> and calling it. I have handled creation either by explicit allocation such as 
> [[HandlerClass alloc] initWith...] or by writing a class method to create an 
> object like [HandlerClass createHandlerWith...]. I then call the appropriate 
> action method like [handlerObject beginProcesssing...] and return to the 
> event loop. The handler class handles interactions, and releases itself when 
> it is done. This does not result in leaks, but the analyzer warns me that the 
> handler is potentially leaking from the document class.

The analyzer is right in terms of object graph. If you consider your call to 
-init as an initial ownership of your document on the handler, then it is the 
owner which must relinquish its ownership, and not the object owned.

In your case, I’d recommend, even if it seems artificial, that the handler, 
when done, informs the document object through a callback which releases it. 
This way, the analyzer won’t protest, and the code is neater and future proof.

Vincent_______________________________________________

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