Should images returned from NSTableView's dragImageForRowsWithIndexes be autoreleased?

Christiaan Hofman cmhofman at gmail.com
Mon Sep 24 11:27:32 PDT 2007


Of course they should be autoreleased. It follows the general rules  
for retaining objects: unless a method name starts with "copy" or  
"init", the returned object should not be explicitly retained (unless  
the object is kept around in an ivar or a global instance of course,  
which here is probably not the case).

Christiaan

On 24 Sep 2007, at 8:20 PM, Michael Dupuis wrote:

> Greetings,
>
> I have a table subclass that implements
> dragImageForRowsWithIndexes:::: and have random
> reports of a crash while in the drag loop code (not my
> own) that makes me wonder about the images that are
> created in the implementation: should images alloc'd
> in this call be "leaked" i.e. not released, not
> autoreleased, or should they be autoreleased? Right
> now I autorelease them, and I can't really find
> anything in the documentation or the list that
> specifies the actual image retention explicitly.
>
> Thanks,
>
> Michael
>


More information about the MacOSX-dev mailing list