Add macro for ARC conditional call to [super dealloc]

This commit is contained in:
Olivier Poitrey 2012-03-11 16:59:37 +01:00
parent dcc6673bf1
commit ab97899a23
6 changed files with 7 additions and 19 deletions

View File

@ -81,9 +81,7 @@ static SDImageCache *instance;
[[NSNotificationCenter defaultCenter] removeObserver:self];
#if ! __has_feature(objc_arc)
[super dealloc];
#endif
SDWISuperDealoc;
}
#pragma mark SDImageCache (class methods)

View File

@ -29,6 +29,7 @@
#define SDWIReturnRetained SDWIRetain
#define SDWIRelease(__v) ([__v release], __v = nil);
#define SDWISuperDealoc [super dealloc];
#define SDWIWeak
#else
@ -40,6 +41,7 @@
#define SDWIReturnRetained(__v) (__v)
#define SDWIRelease(__v)
#define SDWISuperDealoc
#define SDWIWeak __unsafe_unretained
#endif

View File

@ -77,10 +77,7 @@ static SDWebImageDecoder *sharedInstance;
- (void)dealloc
{
SDWIRelease(imageDecodingQueue);
#if ! __has_feature(objc_arc)
[super dealloc];
#endif
SDWISuperDealoc;
}
+ (SDWebImageDecoder *)sharedImageDecoder

View File

@ -157,10 +157,7 @@ NSString *const SDWebImageDownloadStopNotification = @"SDWebImageDownloadStopNot
SDWIRelease(connection);
SDWIRelease(imageData);
SDWIRelease(userInfo);
#if ! __has_feature(objc_arc)
[super dealloc];
#endif
SDWISuperDealoc;
}

View File

@ -52,10 +52,7 @@ static SDWebImageManager *instance;
SDWIRelease(cacheURLs);
SDWIRelease(downloaderForURL);
SDWIRelease(failedURLs);
#if ! __has_feature(objc_arc)
[super dealloc];
#endif
SDWISuperDealoc;
}

View File

@ -106,10 +106,7 @@ static SDWebImagePrefetcher *instance;
- (void)dealloc
{
self.prefetchURLs = nil;
#if ! __has_feature(objc_arc)
[super dealloc];
#endif
SDWISuperDealoc;
}
@end