Committed by
Ben Copsey
Fix for crash when cancelling requests.
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.
Showing
1 changed file
with
6 additions
and
0 deletions
@@ -1711,6 +1711,12 @@ static NSOperationQueue *sharedQueue = nil; | @@ -1711,6 +1711,12 @@ static NSOperationQueue *sharedQueue = nil; | ||
1711 | 1711 | ||
1712 | [failedRequest reportFailure]; | 1712 | [failedRequest reportFailure]; |
1713 | 1713 | ||
1714 | + if (!inProgress) | ||
1715 | + { | ||
1716 | + // if we're not in progress, we can't notify the queue we've finished (doing so can cause a crash later on) | ||
1717 | + // "markAsFinished" will be at the start of main() when we are started | ||
1718 | + return; | ||
1719 | + } | ||
1714 | // markAsFinished may well cause this object to be dealloced | 1720 | // markAsFinished may well cause this object to be dealloced |
1715 | [self retain]; | 1721 | [self retain]; |
1716 | [self markAsFinished]; | 1722 | [self markAsFinished]; |
-
Please register or login to post a comment