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

avoid crash #37

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open

Conversation

kirayamato1989
Copy link

when an error occur the giftGroup will been leaved, but the loop will continue. Finally at the last time the code will be execute giftGroup.leave() this will crash

@ignotusverum ignotusverum mentioned this pull request Oct 28, 2017
gifGroup.enter()

generator.generateCGImagesAsynchronously(forTimes: times, completionHandler: { (requestedTime, image, actualTime, result, error) in
guard let imageRef = image , error == nil else {
print("An error occurred: \(error), image is \(image)")
dispatchError = true
gifGroup.leave()
Copy link
Collaborator

@nakajijapan nakajijapan Oct 29, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think that gifGroup.leave()'s position isn't good. In this case, leave is called only if an error doesn't occur. We should call leave every cases.

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

Successfully merging this pull request may close these issues.

2 participants