__unsafe_unretained does not prevent self retain-cycles when not under ARC

This commit is contained in:
Pierre-Olivier Latour
2014-04-09 11:10:45 -07:00
parent 811e45ab26
commit efad06f506
3 changed files with 12 additions and 0 deletions
+4
View File
@@ -663,7 +663,11 @@ static void _NetServiceClientCallBack(CFNetServiceRef service, CFStreamError* er
- (void)addGETHandlerForBasePath:(NSString*)basePath directoryPath:(NSString*)directoryPath indexFilename:(NSString*)indexFilename cacheAge:(NSUInteger)cacheAge allowRangeRequests:(BOOL)allowRangeRequests {
if ([basePath hasPrefix:@"/"] && [basePath hasSuffix:@"/"]) {
#if __has_feature(objc_arc)
GCDWebServer* __unsafe_unretained server = self;
#else
__block GCDWebServer* server = self;
#endif
[self addHandlerWithMatchBlock:^GCDWebServerRequest *(NSString* requestMethod, NSURL* requestURL, NSDictionary* requestHeaders, NSString* urlPath, NSDictionary* urlQuery) {
if (![requestMethod isEqualToString:@"GET"]) {