Better ARC support

This commit is contained in:
Olivier Poitrey 2012-03-12 11:46:16 +01:00
parent ab97899a23
commit 580a90d6a0
5 changed files with 18 additions and 16 deletions

View File

@ -75,9 +75,9 @@ static SDImageCache *instance;
- (void)dealloc
{
SDWIRelease(memCache);
SDWIRelease(diskCachePath);
SDWIRelease(cacheInQueue);
SDWISafeRelease(memCache);
SDWISafeRelease(diskCachePath);
SDWISafeRelease(cacheInQueue);
[[NSNotificationCenter defaultCenter] removeObserver:self];

View File

@ -28,7 +28,8 @@
#define SDWIRetain(__v) ([__v retain]);
#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 SDWIWeak
@ -41,6 +42,7 @@
#define SDWIReturnRetained(__v) (__v)
#define SDWIRelease(__v)
#define SDWISafeRelease(__v) (__v = nil);
#define SDWISuperDealoc
#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];
SDWIRelease(image)
SDWISafeRelease(image)
image = scaledImage;
}

View File

@ -76,7 +76,7 @@ static SDWebImageDecoder *sharedInstance;
- (void)dealloc
{
SDWIRelease(imageDecodingQueue);
SDWISafeRelease(imageDecodingQueue);
SDWISuperDealoc;
}

View File

@ -153,10 +153,10 @@ NSString *const SDWebImageDownloadStopNotification = @"SDWebImageDownloadStopNot
- (void)dealloc
{
[[NSNotificationCenter defaultCenter] removeObserver:self];
SDWIRelease(url);
SDWIRelease(connection);
SDWIRelease(imageData);
SDWIRelease(userInfo);
SDWISafeRelease(url);
SDWISafeRelease(connection);
SDWISafeRelease(imageData);
SDWISafeRelease(userInfo);
SDWISuperDealoc;
}

View File

@ -46,12 +46,12 @@ static SDWebImageManager *instance;
- (void)dealloc
{
SDWIRelease(downloadDelegates);
SDWIRelease(downloaders);
SDWIRelease(cacheDelegates);
SDWIRelease(cacheURLs);
SDWIRelease(downloaderForURL);
SDWIRelease(failedURLs);
SDWISafeRelease(downloadDelegates);
SDWISafeRelease(downloaders);
SDWISafeRelease(cacheDelegates);
SDWISafeRelease(cacheURLs);
SDWISafeRelease(downloaderForURL);
SDWISafeRelease(failedURLs);
SDWISuperDealoc;
}