Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Retain cycle #58

Closed
coppercash opened this issue Jan 28, 2014 · 1 comment
Closed

Retain cycle #58

coppercash opened this issue Jan 28, 2014 · 1 comment

Comments

@coppercash
Copy link

Hi,
Thanks for the excellent work.
I found a "retain cycle".
IDMZoomingScrollView -> IDMPhoto -> IDMProgressUpdateBlock -> IDMZoomingScrollView

- (void)configurePage:(IDMZoomingScrollView *)page forIndex:(NSUInteger)index {
    page.frame = [self frameForPageAtIndex:index];
    page.tag = PAGE_INDEX_TAG_OFFSET + index;
    page.photo = [self photoAtIndex:index];

    __block __weak IDMPhoto *photo = (IDMPhoto*)page.photo;
    photo.progressUpdateBlock = ^(CGFloat progress){
        [page setProgress:progress forPhoto:photo];
    };
}

Should use a '__weak' ref for page involved in the block above, or break the cycle in method unloadUnderlyingImage.

@eduardocallado
Copy link
Collaborator

Fixed! It will be in the next version. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants