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
Showing
1 changed file
with
3 additions
and
1 deletions
@@ -48,7 +48,6 @@ BOOL ImageDataHasPNGPreffix(NSData *data) { | @@ -48,7 +48,6 @@ BOOL ImageDataHasPNGPreffix(NSData *data) { | ||
48 | static id instance; | 48 | static id instance; |
49 | dispatch_once(&once, ^{ | 49 | dispatch_once(&once, ^{ |
50 | instance = [self new]; | 50 | instance = [self new]; |
51 | - kPNGSignatureData = [NSData dataWithBytes:kPNGSignatureBytes length:8]; | ||
52 | }); | 51 | }); |
53 | return instance; | 52 | return instance; |
54 | } | 53 | } |
@@ -61,6 +60,9 @@ BOOL ImageDataHasPNGPreffix(NSData *data) { | @@ -61,6 +60,9 @@ BOOL ImageDataHasPNGPreffix(NSData *data) { | ||
61 | if ((self = [super init])) { | 60 | if ((self = [super init])) { |
62 | NSString *fullNamespace = [@"com.hackemist.SDWebImageCache." stringByAppendingString:ns]; | 61 | NSString *fullNamespace = [@"com.hackemist.SDWebImageCache." stringByAppendingString:ns]; |
63 | 62 | ||
63 | + // initialise PNG signature data | ||
64 | + kPNGSignatureData = [NSData dataWithBytes:kPNGSignatureBytes length:8]; | ||
65 | + | ||
64 | // Create IO serial queue | 66 | // Create IO serial queue |
65 | _ioQueue = dispatch_queue_create("com.hackemist.SDWebImageCache", DISPATCH_QUEUE_SERIAL); | 67 | _ioQueue = dispatch_queue_create("com.hackemist.SDWebImageCache", DISPATCH_QUEUE_SERIAL); |
66 | 68 |
-
Please register or login to post a comment