Merge pull request #1221 from OliverLetterer/race-2
[Race] Fixing AFHTTPRequestOperation.HTTPError being overreleased.
This commit is contained in:
commit
7562fce4b9
1 changed files with 21 additions and 1 deletions
|
|
@ -108,18 +108,38 @@ static void AFSwizzleClassMethodWithClassAndSelectorUsingBlock(Class klass, SEL
|
||||||
#pragma mark -
|
#pragma mark -
|
||||||
|
|
||||||
@interface AFHTTPRequestOperation ()
|
@interface AFHTTPRequestOperation ()
|
||||||
|
@property (readwrite, nonatomic, strong) NSRecursiveLock *lock;
|
||||||
@property (readwrite, nonatomic, strong) NSURLRequest *request;
|
@property (readwrite, nonatomic, strong) NSURLRequest *request;
|
||||||
@property (readwrite, nonatomic, strong) NSHTTPURLResponse *response;
|
@property (readwrite, nonatomic, strong) NSHTTPURLResponse *response;
|
||||||
@property (readwrite, nonatomic, strong) NSError *HTTPError;
|
@property (readwrite, strong) NSError *HTTPError;
|
||||||
@end
|
@end
|
||||||
|
|
||||||
@implementation AFHTTPRequestOperation
|
@implementation AFHTTPRequestOperation
|
||||||
@synthesize HTTPError = _HTTPError;
|
@synthesize HTTPError = _HTTPError;
|
||||||
@synthesize successCallbackQueue = _successCallbackQueue;
|
@synthesize successCallbackQueue = _successCallbackQueue;
|
||||||
@synthesize failureCallbackQueue = _failureCallbackQueue;
|
@synthesize failureCallbackQueue = _failureCallbackQueue;
|
||||||
|
@dynamic lock;
|
||||||
@dynamic request;
|
@dynamic request;
|
||||||
@dynamic response;
|
@dynamic response;
|
||||||
|
|
||||||
|
- (NSError *)HTTPError
|
||||||
|
{
|
||||||
|
[self.lock lock];
|
||||||
|
NSError *HTTPError = _HTTPError;
|
||||||
|
[self.lock unlock];
|
||||||
|
|
||||||
|
return HTTPError;
|
||||||
|
}
|
||||||
|
|
||||||
|
- (void)setHTTPError:(NSError *)HTTPError
|
||||||
|
{
|
||||||
|
[self.lock lock];
|
||||||
|
if (HTTPError != _HTTPError) {
|
||||||
|
_HTTPError = HTTPError;
|
||||||
|
}
|
||||||
|
[self.lock unlock];
|
||||||
|
}
|
||||||
|
|
||||||
- (void)dealloc {
|
- (void)dealloc {
|
||||||
if (_successCallbackQueue) {
|
if (_successCallbackQueue) {
|
||||||
#if !OS_OBJECT_USE_OBJC
|
#if !OS_OBJECT_USE_OBJC
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue