Removing unnecessary NSPort instance, which was attached to NSRunLoop to prevent it from immediately exiting

This commit is contained in:
Mattt Thompson 2011-08-07 14:30:01 -05:00
parent 26984f4414
commit ceed5f6b9f
2 changed files with 0 additions and 7 deletions

View file

@ -28,7 +28,6 @@ extern NSString * const AFHTTPOperationDidFinishNotification;
@interface AFHTTPRequestOperation : NSOperation { @interface AFHTTPRequestOperation : NSOperation {
@private @private
NSURLConnection *_connection; NSURLConnection *_connection;
NSPort *_port;
NSSet *_runLoopModes; NSSet *_runLoopModes;
NSURLRequest *_request; NSURLRequest *_request;

View file

@ -78,7 +78,6 @@ static inline BOOL AFHTTPOperationStateTransitionIsValid(AFHTTPOperationState fr
@interface AFHTTPRequestOperation () @interface AFHTTPRequestOperation ()
@property (nonatomic, assign) AFHTTPOperationState state; @property (nonatomic, assign) AFHTTPOperationState state;
@property (nonatomic, assign) BOOL isCancelled; @property (nonatomic, assign) BOOL isCancelled;
@property (readwrite, nonatomic, retain) NSPort *port;
@property (readwrite, nonatomic, retain) NSMutableData *dataAccumulator; @property (readwrite, nonatomic, retain) NSMutableData *dataAccumulator;
@property (readwrite, nonatomic, copy) AFHTTPRequestOperationCompletionBlock completion; @property (readwrite, nonatomic, copy) AFHTTPRequestOperationCompletionBlock completion;
@ -90,7 +89,6 @@ static inline BOOL AFHTTPOperationStateTransitionIsValid(AFHTTPOperationState fr
@synthesize isCancelled = _isCancelled; @synthesize isCancelled = _isCancelled;
@synthesize connection = _connection; @synthesize connection = _connection;
@synthesize runLoopModes = _runLoopModes; @synthesize runLoopModes = _runLoopModes;
@synthesize port = _port;
@synthesize request = _request; @synthesize request = _request;
@synthesize response = _response; @synthesize response = _response;
@synthesize error = _error; @synthesize error = _error;
@ -124,7 +122,6 @@ static inline BOOL AFHTTPOperationStateTransitionIsValid(AFHTTPOperationState fr
- (void)dealloc { - (void)dealloc {
[_runLoopModes release]; [_runLoopModes release];
[_port release];
[_request release]; [_request release];
[_response release]; [_response release];
@ -139,7 +136,6 @@ static inline BOOL AFHTTPOperationStateTransitionIsValid(AFHTTPOperationState fr
- (void)cleanup { - (void)cleanup {
for (NSString *runLoopMode in self.runLoopModes) { for (NSString *runLoopMode in self.runLoopModes) {
[[NSRunLoop currentRunLoop] removePort:self.port forMode:runLoopMode];
[self.connection unscheduleFromRunLoop:[NSRunLoop currentRunLoop] forMode:runLoopMode]; [self.connection unscheduleFromRunLoop:[NSRunLoop currentRunLoop] forMode:runLoopMode];
} }
CFRunLoopStop([[NSRunLoop currentRunLoop] getCFRunLoop]); CFRunLoopStop([[NSRunLoop currentRunLoop] getCFRunLoop]);
@ -204,12 +200,10 @@ static inline BOOL AFHTTPOperationStateTransitionIsValid(AFHTTPOperationState fr
self.state = AFHTTPOperationExecutingState; self.state = AFHTTPOperationExecutingState;
self.connection = [[[NSURLConnection alloc] initWithRequest:self.request delegate:self startImmediately:NO] autorelease]; self.connection = [[[NSURLConnection alloc] initWithRequest:self.request delegate:self startImmediately:NO] autorelease];
self.port = [NSPort port];
NSRunLoop *runLoop = [NSRunLoop currentRunLoop]; NSRunLoop *runLoop = [NSRunLoop currentRunLoop];
for (NSString *runLoopMode in self.runLoopModes) { for (NSString *runLoopMode in self.runLoopModes) {
[self.connection scheduleInRunLoop:runLoop forMode:runLoopMode]; [self.connection scheduleInRunLoop:runLoop forMode:runLoopMode];
[runLoop addPort:self.port forMode:runLoopMode];
} }
[self.connection start]; [self.connection start];