Skip to content

Commit

Permalink
Fix for crash when cancelling requests.
Browse files Browse the repository at this point in the history
It seems that notifying the NSOperationQueue we're complete before we start running causes a problem resulting in a crash.

Hence, we avoid calling markAsFinished unless we're inprogress - main() will call it when we do start.
  • Loading branch information
jogu committed Jul 22, 2010
1 parent 6eee04f commit 887fcad
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions Classes/ASIHTTPRequest.m
Expand Up @@ -1718,6 +1718,12 @@ - (void)failWithError:(NSError *)theError

[failedRequest reportFailure];

if (!inProgress)
{
// if we're not in progress, we can't notify the queue we've finished (doing so can cause a crash later on)
// "markAsFinished" will be at the start of main() when we are started
return;
}
// markAsFinished may well cause this object to be dealloced
[self retain];
[self markAsFinished];
Expand Down

0 comments on commit 887fcad

Please sign in to comment.