Explorar o código

Changed ImageLockInitializer to ImageSyncronizer and used correct lock and unlock

Paulo Ferreira %!s(int64=10) %!d(string=hai) anos
pai
achega
b8dc6682cb
Modificáronse 1 ficheiros con 12 adicións e 4 borrados
  1. 12 4
      AFNetworking/AFURLResponseSerialization.m

+ 12 - 4
AFNetworking/AFURLResponseSerialization.m

@@ -530,18 +530,26 @@ static id AFJSONObjectByRemovingKeysWithNullValues(id JSONObject, NSJSONReadingO
 #import <CoreGraphics/CoreGraphics.h>
 
 NSLock* _AFImageLock = nil;
-@interface ImageLockInitializer : NSObject
+@interface ImageSyncronizer : NSObject
 @end
-@implementation ImageLockInitializer : NSObject
+@implementation ImageSyncronizer : NSObject
 + (void)initialize {
     _AFImageLock = [[NSLock alloc] init];
 }
+
++ (void) imageLock {
+    [_AFImageLock lock];
+}
+
++ (void) imageUnlock {
+    [_AFImageLock unlock];
+}
 @end
 
 static UIImage * AFImageWithDataAtScale(NSData *data, CGFloat scale) {
-    [_AFImageLock lock];
+    [ImageSyncronizer imageLock];
     UIImage *image = [[UIImage alloc] initWithData:data];
-    [_AFImageLock unlock];
+    [ImageSyncronizer imageUnlock];
     if (image.images) {
         return image;
     }