PerfectImageCropper icon indicating copy to clipboard operation
PerfectImageCropper copied to clipboard

Crash when dealloc is called.

Open CokePokes opened this issue 11 years ago • 0 comments

You nil image in the dealloc. Which creates "Terminating app due to uncaught exception 'CALayerInvalidGeometry', reason: 'CALayer position contains NaN: [nan nan]'" in setImage when dealloc is called.

Do this:

- (void)setImage:(UIImage *)image
  {
    if (_image != image) {
        _image = [image retain];
    }

    if (image != nil){   //check if image is nil

    float _imageScale = self.frame.size.width / image.size.width;
    self.imageView.frame = CGRectMake(0, 0, image.size.width*_imageScale, image.size.height*_imageScale);
    _originalImageViewSize = CGSizeMake(image.size.width*_imageScale, image.size.height*_imageScale);
    imageView.image = image;
    imageView.center = CGPointMake(self.frame.size.width/2.0, self.frame.size.height/2.0);
    }
}

CokePokes avatar Feb 13 '14 14:02 CokePokes