On Jan 26, 2012, at 1:51 PM, Jan E. Schotsman wrote:
Hello,
This code is given in the Transitioning to ARC Release Notes as an example
of accomodating blocks in an ARC environment:
__block MyViewController *myController = [[MyViewController alloc] init…];
// ...
Le 26 janv. 2012 à 22:51, Jan E. Schotsman a écrit :
Hello,
This code is given in the Transitioning to ARC Release Notes as an example
of accomodating blocks in an ARC environment:
__block MyViewController *myController = [[MyViewController alloc] init…];
// ...
On 1/26/12 1:51 PM, Jan E. Schotsman wrote:
Hello,
This code is given in the Transitioning to ARC Release Notes as an
example of accomodating blocks in an ARC environment:
__block MyViewController *myController = [[MyViewController alloc] init…];
// ...
myController.completionHandler =
On Jan 26, 2012, at 1:51 PM, Jan E. Schotsman wrote:
Supposedly this avoids a retain cycle. But where is the cycle? At least two
objects are needed for a cycle. What is the second one?
The block. When a block is copied (which it has to be, in order to be called
later after the calling
On 26 Jan 2012, at 3:51 PM, Jan E. Schotsman wrote:
This code is given in the Transitioning to ARC Release Notes as an example
of accomodating blocks in an ARC environment:
__block MyViewController *myController = [[MyViewController alloc] init…];
There is a MyViewController object named
On 2012-01-26, at 3:51 PM, Jan E. Schotsman wrote:
Hello,
This code is given in the Transitioning to ARC Release Notes as an example
of accomodating blocks in an ARC environment:
__block MyViewController *myController = [[MyViewController alloc] init…];
// ...
On Jan 26, 2012, at 3:51 PM, Jan E. Schotsman wrote:
This code is given in the Transitioning to ARC Release Notes as an example
of accomodating blocks in an ARC environment:
__block MyViewController *myController = [[MyViewController alloc] init…];
// ...
myController.completionHandler =
On Jan 26, 2012, at 1:51 PM, Jan E. Schotsman wrote:
This code is given in the Transitioning to ARC Release Notes as an example
of accomodating blocks in an ARC environment:
__block MyViewController *myController = [[MyViewController alloc] init…];
// ...
myController.completionHandler =
Without ARC, you would use __block to prevent the block from retaining the
object and causing the retain cycle. With ARC, however, the object is retained
when you put it into the variable, so to avoid a retain cycle, you have to
declare it like so:
__unsafe_unretained __block
On Jan 26, 2012, at 2:44 PM, Conrad Shultz wrote:
However, __block variables are NOT retained automatically by a block
during capture, so this breaks the retain cycle.
This is not true under ARC, where __block variables also retain.
--
David Duncan
On Thu, Jan 26, 2012 at 2:44 PM, Conrad Shultz
con...@synthetiqsolutions.com wrote:
However, __block variables are NOT retained automatically by a block
during capture, so this breaks the retain cycle.
__block variables *are* retained under ARC:
On 1/26/12 4:21 PM, Kyle Sluder wrote:
On Thu, Jan 26, 2012 at 2:44 PM, Conrad Shultz
con...@synthetiqsolutions.com wrote:
However, __block variables are NOT retained automatically by a block
during capture, so this breaks the retain cycle.
__block variables *are* retained under ARC:
Hi,
So, when myController is nil'ed out, ARC releases it, and it releases
the block in turn. No leaks/abandoned memory.
A special form of this is the idiom:
__block id mySelf = self;
^{
[mySelf doSomething];
}
Wouldn't using __weak instead of __block be better and clearer in the
On Jan 27, 2012, at 6:44 AM, Conrad Shultz wrote:
On 1/26/12 1:51 PM, Jan E. Schotsman wrote:
The block normally would retain variables it captures from its scope,
including, in this case, myController. Presumably myController would
retain the completionHandler block, ergo a retain
On 2012-01-26, at 6:09 PM, Jeff Kelley wrote:
Without ARC, you would use __block to prevent the block from retaining the
object and causing the retain cycle. With ARC, however, the object is
retained when you put it into the variable, so to avoid a retain cycle, you
have to declare it like
On Jan 26, 2012, at 6:04 PM, Marco Tabini wrote:
On 2012-01-26, at 6:09 PM, Jeff Kelley wrote:
Without ARC, you would use __block to prevent the block from retaining the
object and causing the retain cycle. With ARC, however, the object is
retained when you put it into the variable, so to
On Jan 27, 2012, at 10:04 AM, Marco Tabini wrote:
On 2012-01-26, at 6:09 PM, Jeff Kelley wrote:
Without ARC, you would use __block to prevent the block from retaining the
object and causing the retain cycle. With ARC, however, the object is
retained when you put it into the variable, so
On Jan 26, 2012, at 10:45 PM, Roland King wrote:
On Jan 27, 2012, at 10:04 AM, Marco Tabini wrote:
On 2012-01-26, at 6:09 PM, Jeff Kelley wrote:
Without ARC, you would use __block to prevent the block from retaining the
object and causing the retain cycle. With ARC, however, the object
18 matches
Mail list logo