SwiftyGif: Crash: on deleteImageView(imageView: UIImageView)

the library crashes from time to time (not consistant) on

    public func deleteImageView(imageView: UIImageView){
        if let index = self.displayViews.indexOf(imageView) {
                self.displayViews.removeAtIndex(index)
                self.totalGifSize -= imageView.gifImage!.imageSize!
                if self.totalGifSize < memoryLimit && !self.haveCache {
                    self.haveCache = true
                    for imageView in self.displayViews{
                        dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_HIGH,0)){
                            imageView.updateCache()
                        }
                    }
                }
        }
    }

on self.displayViews.removeAtIndex(index) line.

The case: displaying a gif when my app starts, and after login, i remove the screen with the gif form memory, althuogh i dont do any special handling of the SwiftyGif manager Should i remove the gif when im done using it or reset the manager? what am i missing here?

thanks.

About this issue

  • Original URL
  • State: closed
  • Created 8 years ago
  • Comments: 20 (4 by maintainers)

Commits related to this issue

Most upvoted comments

I’m having this issue as well… sometimes I pop controllers to a main page that’s populated with GIFs, and the app may crash… sometimes with a nil error or delete error

On Thursday, August 25, 2016, Liron K notifications@github.com wrote:

the library crashes from time to time (not consistant) on

public func deleteImageView(imageView: UIImageView){
    if let index = self.displayViews.indexOf(imageView) {
            self.displayViews.removeAtIndex(index)
            self.totalGifSize -= imageView.gifImage!.imageSize!
            if self.totalGifSize < memoryLimit && !self.haveCache {
                self.haveCache = true
                for imageView in self.displayViews{
                    dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_HIGH,0)){
                        imageView.updateCache()
                    }
                }
            }
    }
}

on self.displayViews.removeAtIndex(index) line.

The case: displaying a gif when my app starts, and after login, i remove the screen with the gif form memory, althuogh i dont do any special handling of the SwiftyGif manager Should i remove the gif when im done using it or reset the manager? what am i missing here?

thanks.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/kirualex/SwiftyGif/issues/12, or mute the thread https://github.com/notifications/unsubscribe-auth/ASRk4VgmDDfILAcRBc6ELBKeOOer8Yt4ks5qjbxXgaJpZM4JtO2- .