• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Block gets NULL-ified when animation completes
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Block gets NULL-ified when animation completes


  • Subject: Re: Block gets NULL-ified when animation completes
  • From: Vlad Alekseev <email@hidden>
  • Date: Thu, 15 Aug 2013 18:54:21 +0400

> As I said before, this is a bug in your code. ‘block’ needs to be copied since it is going to be called after the calling function returns.


I work under ARC. It goes to heap automatically.

Also, there are some circumstances that proves your wrong guess:

1. If I copy it manually, it still gets NULLified.
2. If there are some items in the collection view, it works as expected, no explicit copy needed.

So it seems for me like a bug in the ARC/runtime or in the collection view (unlikely).

Vlad.

15 авг. 2013 г., в 18:49, Jens Alfke <email@hidden> написал(а):

>
> On Aug 15, 2013, at 5:41 AM, Vlad Alekseev <email@hidden> wrote:
>
>> dispatch_block_t block = ^{
>>    printf("finished");
>> };
>>
>> UICollectionViewFlowLayout *layout = (UICollectionViewFlowLayout *)self.collectionView.collectionViewLayout;
>> [self.collectionView performBatchUpdates:^{
>>    layout.minimumInteritemSpacing = 20;
>> } completion:^(BOOL finished) {
>>    block();
>> }];
>
>
> Yes, the collection view copies the completion block you pass it. But that block is not ‘block’, it’s the inline block literal that calls ‘block’. That gets copied, but when that is called it still tries to call the uncopied ‘block’, which fails.
>
> —Jens

_______________________________________________

Cocoa-dev mailing list (email@hidden)

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:

This email sent to email@hidden


References: 
 >Block gets NULL-ified when animation completes (From: Vlad Alekseev <email@hidden>)
 >Re: Block gets NULL-ified when animation completes (From: Jens Alfke <email@hidden>)
 >Re: Block gets NULL-ified when animation completes (From: Vlad Alekseev <email@hidden>)
 >Re: Block gets NULL-ified when animation completes (From: Vlad Alekseev <email@hidden>)
 >Re: Block gets NULL-ified when animation completes (From: Jens Alfke <email@hidden>)

  • Prev by Date: Re: Block gets NULL-ified when animation completes
  • Next by Date: Re: Block gets NULL-ified when animation completes
  • Previous by thread: Re: Block gets NULL-ified when animation completes
  • Next by thread: Re: Block gets NULL-ified when animation completes
  • Index(es):
    • Date
    • Thread