Skip to content

Commit b271cbb

Browse files
committed
initialise kPNGSignatureData data
in SDImageCache initWithNamespace method. This ensures the kPNGSignatureData is always initialised even if the we alloc SDImageCache without using the sharedImageCache singleton
1 parent 6698910 commit b271cbb

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

SDWebImage/SDImageCache.m

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,6 @@ + (SDImageCache *)sharedImageCache {
4848
static id instance;
4949
dispatch_once(&once, ^{
5050
instance = [self new];
51-
kPNGSignatureData = [NSData dataWithBytes:kPNGSignatureBytes length:8];
5251
});
5352
return instance;
5453
}
@@ -61,6 +60,9 @@ - (id)initWithNamespace:(NSString *)ns {
6160
if ((self = [super init])) {
6261
NSString *fullNamespace = [@"com.hackemist.SDWebImageCache." stringByAppendingString:ns];
6362

63+
// initialise PNG signature data
64+
kPNGSignatureData = [NSData dataWithBytes:kPNGSignatureBytes length:8];
65+
6466
// Create IO serial queue
6567
_ioQueue = dispatch_queue_create("com.hackemist.SDWebImageCache", DISPATCH_QUEUE_SERIAL);
6668

0 commit comments

Comments
 (0)