Update for #1802 - made sure we don’t get into problems when checking for self.activityIndicator on one thread and allocating on another. Also, made sure `sd_removeActivityIndicator` executes on the main queue
This commit is contained in:
parent
7bf69862aa
commit
a6af214ee8
|
@ -156,8 +156,8 @@ static char TAG_ACTIVITY_SHOW;
|
|||
|
||||
- (void)sd_addActivityIndicator {
|
||||
#if SD_UIKIT
|
||||
if (!self.activityIndicator) {
|
||||
dispatch_main_async_safe(^{
|
||||
dispatch_main_async_safe(^{
|
||||
if (!self.activityIndicator) {
|
||||
self.activityIndicator = [[UIActivityIndicatorView alloc] initWithActivityIndicatorStyle:[self sd_getIndicatorStyle]];
|
||||
self.activityIndicator.translatesAutoresizingMaskIntoConstraints = NO;
|
||||
|
||||
|
@ -177,10 +177,7 @@ static char TAG_ACTIVITY_SHOW;
|
|||
attribute:NSLayoutAttributeCenterY
|
||||
multiplier:1.0
|
||||
constant:0.0]];
|
||||
});
|
||||
}
|
||||
|
||||
dispatch_main_async_safe(^{
|
||||
}
|
||||
[self.activityIndicator startAnimating];
|
||||
});
|
||||
#endif
|
||||
|
@ -188,10 +185,12 @@ static char TAG_ACTIVITY_SHOW;
|
|||
|
||||
- (void)sd_removeActivityIndicator {
|
||||
#if SD_UIKIT
|
||||
if (self.activityIndicator) {
|
||||
[self.activityIndicator removeFromSuperview];
|
||||
self.activityIndicator = nil;
|
||||
}
|
||||
dispatch_main_async_safe(^{
|
||||
if (self.activityIndicator) {
|
||||
[self.activityIndicator removeFromSuperview];
|
||||
self.activityIndicator = nil;
|
||||
}
|
||||
});
|
||||
#endif
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue