Merge pull request #3258 from GetToSet/sdanimatedimagerep-copy-semantic

Make SDAnimatedImageRep confirms to correct copy semantic
This commit is contained in:
DreamPiggy 2021-09-30 17:29:09 +08:00 committed by GitHub
commit 923e175326
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
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
+ (instancetype)imageRepWithData:(NSData *)data {
SDAnimatedImageRep *imageRep = [[SDAnimatedImageRep alloc] initWithData:data];