Re: Memory management of document modal panels


Jeff Laing
 

According to Mike Ash
(https://www.mikeash.com/pyblog/friday-qa-2009-08-14-practical-blocks.html
- see Caveats) self should be being retained.

Apple (https://developer.apple.com/library/content/documentation/Cocoa/Conceptual/Blocks/Articles/bxVariables.html#//apple_ref/doc/uid/TP40007502-CH6-SW3)
also suggest that if you reference a local variable inside the block,
then self will be retained.

I can't see anywhere where they suggest the behavior changes with the
retention-model being used; just that a block doesn't retain anything
until it is copied and in the case where you pass a block in as a
completion handler, it is that methods responsibility to copy the
block.

Jeff Laing <jefflaing@...>
-------------------------------------------------------------------------------
"... because even if we can't um, if we can't rise to his level, no at
least we can, we can drag him down to ours ..."
-- William Gaddis, "JR".

Join cocoa@apple-dev.groups.io to automatically receive all group messages.