Re: Capturing 'self' strongly in this block is likely to lead to a retain cycle

2012-07-10 Thread rols
On 09.07.2012, at 18:03, Fritz Anderson wrote: You can break this by having a strong reference to self that the block can manage independently. __block MyClass * blockSelf = self; [self.operationQueue addOperationWithBlock:^{ [blockSelf bar]; blockSelf = nil; }];

Re: Capturing 'self' strongly in this block is likely to lead to a retain cycle

2012-07-10 Thread Fritz Anderson
On 9 Jul 2012, at 6:35 PM, Shane Stanley wrote: On 10/07/2012, at 2:03 AM, Fritz Anderson wrote: In practice, NSOperationQueue probably releases the block when it's done with it I'm curious about your use of the word probably here. Can you explain? The documentation for

Re: Capturing 'self' strongly in this block is likely to lead to a retain cycle

2012-07-10 Thread Jonathan Taylor
In practice, NSOperationQueue probably releases the block when it's done with it I'm curious about your use of the word probably here. Can you explain? This is probably not what the OP had in mind, but I might mention that I've seen situations where autoreleases associated with

Re: Capturing 'self' strongly in this block is likely to lead to a retain cycle

2012-07-10 Thread David Duncan
On Jul 10, 2012, at 12:56 AM, Jonathan Taylor wrote: In practice, NSOperationQueue probably releases the block when it's done with it I'm curious about your use of the word probably here. Can you explain? This is probably not what the OP had in mind, but I might mention that I've seen

Capturing 'self' strongly in this block is likely to lead to a retain cycle

2012-07-09 Thread Andreas Grosam
I get the mentioned warning in my code and I'm wondering if this a possibly issue in my case: ARC enabled. The warning Capturing 'self' strongly in this block is likely to lead to a retain cycle is issued in this method: - (void) foo { [self.operationQueue addOperationWithBlock:^{

Re: Capturing 'self' strongly in this block is likely to lead to a retain cycle

2012-07-09 Thread Fritz Anderson
On 9 Jul 2012, at 10:40 AM, Andreas Grosam wrote: The warning Capturing 'self' strongly in this block is likely to lead to a retain cycle is issued in this method: - (void) foo { [self.operationQueue addOperationWithBlock:^{ [self bar]; }]; } property operationQueue is

Re: Capturing 'self' strongly in this block is likely to lead to a retain cycle

2012-07-09 Thread Sean McBride
On Mon, 9 Jul 2012 11:03:50 -0500, Fritz Anderson said: You correctly describe the cycle. In practice, NSOperationQueue probably releases the block when it's done with it, and breaks the cycle, but clang can't know that, so it has to warn of the likely cycle. You can break this by having a

Re: Capturing 'self' strongly in this block is likely to lead to a retain cycle

2012-07-09 Thread Shane Stanley
On 10/07/2012, at 2:03 AM, Fritz Anderson wrote: In practice, NSOperationQueue probably releases the block when it's done with it I'm curious about your use of the word probably here. Can you explain? -- Shane Stanley sstan...@myriad-com.com.au 'AppleScriptObjC Explored'