Better ARC support
This commit is contained in:
parent
ab97899a23
commit
580a90d6a0
|
@ -75,9 +75,9 @@ static SDImageCache *instance;
|
||||||
|
|
||||||
- (void)dealloc
|
- (void)dealloc
|
||||||
{
|
{
|
||||||
SDWIRelease(memCache);
|
SDWISafeRelease(memCache);
|
||||||
SDWIRelease(diskCachePath);
|
SDWISafeRelease(diskCachePath);
|
||||||
SDWIRelease(cacheInQueue);
|
SDWISafeRelease(cacheInQueue);
|
||||||
|
|
||||||
[[NSNotificationCenter defaultCenter] removeObserver:self];
|
[[NSNotificationCenter defaultCenter] removeObserver:self];
|
||||||
|
|
||||||
|
|
|
@ -28,7 +28,8 @@
|
||||||
#define SDWIRetain(__v) ([__v retain]);
|
#define SDWIRetain(__v) ([__v retain]);
|
||||||
#define SDWIReturnRetained SDWIRetain
|
#define SDWIReturnRetained SDWIRetain
|
||||||
|
|
||||||
#define SDWIRelease(__v) ([__v release], __v = nil);
|
#define SDWIRelease(__v) ([__v release]);
|
||||||
|
#define SDWISafeRelease(__v) ([__v release], __v = nil);
|
||||||
#define SDWISuperDealoc [super dealloc];
|
#define SDWISuperDealoc [super dealloc];
|
||||||
|
|
||||||
#define SDWIWeak
|
#define SDWIWeak
|
||||||
|
@ -41,6 +42,7 @@
|
||||||
#define SDWIReturnRetained(__v) (__v)
|
#define SDWIReturnRetained(__v) (__v)
|
||||||
|
|
||||||
#define SDWIRelease(__v)
|
#define SDWIRelease(__v)
|
||||||
|
#define SDWISafeRelease(__v) (__v = nil);
|
||||||
#define SDWISuperDealoc
|
#define SDWISuperDealoc
|
||||||
|
|
||||||
#define SDWIWeak __unsafe_unretained
|
#define SDWIWeak __unsafe_unretained
|
||||||
|
@ -70,7 +72,7 @@ NS_INLINE UIImage *SDScaledImageForPath(NSString *path, NSData *imageData)
|
||||||
}
|
}
|
||||||
|
|
||||||
UIImage *scaledImage = [[UIImage alloc] initWithCGImage:image.CGImage scale:scale orientation:UIImageOrientationUp];
|
UIImage *scaledImage = [[UIImage alloc] initWithCGImage:image.CGImage scale:scale orientation:UIImageOrientationUp];
|
||||||
SDWIRelease(image)
|
SDWISafeRelease(image)
|
||||||
image = scaledImage;
|
image = scaledImage;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -76,7 +76,7 @@ static SDWebImageDecoder *sharedInstance;
|
||||||
|
|
||||||
- (void)dealloc
|
- (void)dealloc
|
||||||
{
|
{
|
||||||
SDWIRelease(imageDecodingQueue);
|
SDWISafeRelease(imageDecodingQueue);
|
||||||
SDWISuperDealoc;
|
SDWISuperDealoc;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -153,10 +153,10 @@ NSString *const SDWebImageDownloadStopNotification = @"SDWebImageDownloadStopNot
|
||||||
- (void)dealloc
|
- (void)dealloc
|
||||||
{
|
{
|
||||||
[[NSNotificationCenter defaultCenter] removeObserver:self];
|
[[NSNotificationCenter defaultCenter] removeObserver:self];
|
||||||
SDWIRelease(url);
|
SDWISafeRelease(url);
|
||||||
SDWIRelease(connection);
|
SDWISafeRelease(connection);
|
||||||
SDWIRelease(imageData);
|
SDWISafeRelease(imageData);
|
||||||
SDWIRelease(userInfo);
|
SDWISafeRelease(userInfo);
|
||||||
SDWISuperDealoc;
|
SDWISuperDealoc;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -46,12 +46,12 @@ static SDWebImageManager *instance;
|
||||||
|
|
||||||
- (void)dealloc
|
- (void)dealloc
|
||||||
{
|
{
|
||||||
SDWIRelease(downloadDelegates);
|
SDWISafeRelease(downloadDelegates);
|
||||||
SDWIRelease(downloaders);
|
SDWISafeRelease(downloaders);
|
||||||
SDWIRelease(cacheDelegates);
|
SDWISafeRelease(cacheDelegates);
|
||||||
SDWIRelease(cacheURLs);
|
SDWISafeRelease(cacheURLs);
|
||||||
SDWIRelease(downloaderForURL);
|
SDWISafeRelease(downloaderForURL);
|
||||||
SDWIRelease(failedURLs);
|
SDWISafeRelease(failedURLs);
|
||||||
SDWISuperDealoc;
|
SDWISuperDealoc;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue