Fixing crasher in AFNetworkActivityIndicatorManager, due to unsafe calls to updateNetworkActivityIndicatorVisibilityDelayed from multiple threads.

This commit is contained in:
Dave Keck 2013-04-23 11:10:34 -10:00
Родитель 215a32e23c
Коммит fff8704a44
1 изменённых файлов: 12 добавлений и 3 удалений

Просмотреть файл

@ -105,7 +105,10 @@ static NSTimeInterval const kAFNetworkActivityIndicatorInvisibilityDelay = 0.17;
@synchronized(self) {
_activityCount = activityCount;
}
[self updateNetworkActivityIndicatorVisibilityDelayed];
dispatch_async(dispatch_get_main_queue(), ^{
[self updateNetworkActivityIndicatorVisibilityDelayed];
});
}
- (void)incrementActivityCount {
@ -114,7 +117,10 @@ static NSTimeInterval const kAFNetworkActivityIndicatorInvisibilityDelay = 0.17;
_activityCount++;
}
[self didChangeValueForKey:@"activityCount"];
[self updateNetworkActivityIndicatorVisibilityDelayed];
dispatch_async(dispatch_get_main_queue(), ^{
[self updateNetworkActivityIndicatorVisibilityDelayed];
});
}
- (void)decrementActivityCount {
@ -123,7 +129,10 @@ static NSTimeInterval const kAFNetworkActivityIndicatorInvisibilityDelay = 0.17;
_activityCount = MAX(_activityCount - 1, 0);
}
[self didChangeValueForKey:@"activityCount"];
[self updateNetworkActivityIndicatorVisibilityDelayed];
dispatch_async(dispatch_get_main_queue(), ^{
[self updateNetworkActivityIndicatorVisibilityDelayed];
});
}
- (void)networkingOperationDidStart:(NSNotification *)notification {