Make SDAnimatedImageRep confirms to correct copy semantic

This commit is contained in:
Ethan Wong 2021-08-11 23:42:27 +08:00
parent 73cd294129
commit 2b95a12541
No known key found for this signature in database
GPG Key ID: 62BE93C47E7FCE14
1 changed files with 6 additions and 0 deletions

View File

@ -27,6 +27,12 @@
} }
} }
- (instancetype)copyWithZone:(NSZone *)zone {
SDAnimatedImageRep *imageRep = [super copyWithZone:zone];
CFRetain(imageRep->_imageSource);
return imageRep;
}
// `NSBitmapImageRep`'s `imageRepWithData:` is not designed initializer // `NSBitmapImageRep`'s `imageRepWithData:` is not designed initializer
+ (instancetype)imageRepWithData:(NSData *)data { + (instancetype)imageRepWithData:(NSData *)data {
SDAnimatedImageRep *imageRep = [[SDAnimatedImageRep alloc] initWithData:data]; SDAnimatedImageRep *imageRep = [[SDAnimatedImageRep alloc] initWithData:data];