UIPhotoGallery icon indicating copy to clipboard operation
UIPhotoGallery copied to clipboard

“Collection was mutated while being enumerated” on line for (UIPhotoContainerView *subView in reusableViews)

Open kevwkev opened this issue 10 years ago • 2 comments

When I try to zoom in and out multiple times quickly on an image in fullscreen mode, the sample application crashes intermittently. it stops at line: "for (UIPhotoContainerView *subView in reusableViews) {" from "UIPhotoGalleryView.m"

breakpoint analyzer: #0 0x38dd9cc0 in objc_exception_throw () #1 0x2e4c99f0 in __NSFastEnumerationMutationHandler () #2 0x0009d61c in -[UIPhotoGalleryView scrollViewDidScroll:] at UIPhotoGallery/UIPhotoGalleryView.m:172 #3 0x311026e4 in -UIScrollView(UIScrollViewInternal) _notifyDidScroll

kevwkev avatar Apr 15 '14 08:04 kevwkev

I seem to have fixed the issue by taking a copy of the array(reusableViews) Change line #169 in "UIPhotoGalleryView.m" to: for (UIPhotoContainerView *subView in [reusableViews copy]) {

kevwkev avatar Apr 15 '14 20:04 kevwkev

Hi, thanks to your feedback & contribution. Please create a pull request, I'll merge it and update new version.

Thanks again

ethan605 avatar Apr 16 '14 02:04 ethan605