Merge pull request #28 from evanlong/master
Fixing a leak as a result of a race condition in the sample Gowalla client
This commit is contained in:
commit
78f1928f4a
1 changed files with 4 additions and 5 deletions
|
|
@ -32,11 +32,10 @@ NSString * const kAFGowallaBaseURLString = @"https://api.gowalla.com/";
|
|||
@implementation AFGowallaAPIClient
|
||||
|
||||
+ (id)sharedClient {
|
||||
if (_sharedClient == nil) {
|
||||
@synchronized(self) {
|
||||
_sharedClient = [[self alloc] init];
|
||||
}
|
||||
}
|
||||
static dispatch_once_t oncePredicate;
|
||||
dispatch_once(&oncePredicate, ^{
|
||||
_sharedClient = [[self alloc] init];
|
||||
});
|
||||
|
||||
return _sharedClient;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue