Merge branch 'bugfix/bundle_image_access_crash' into 'develop'
sychronize bundled image access to prevent crash See merge request BPHV_MIPS/mvm_core!110
This commit is contained in:
commit
ae94a2f197
@ -380,13 +380,15 @@ static NSString * const STATIC_CACHE_COMPONENT = @"StaticCache.txt";
|
||||
}
|
||||
|
||||
- (nullable UIImage *)getImageFromRegisteredBundles:(nonnull NSString *)imageName {
|
||||
UIImage *image = nil;
|
||||
for (NSBundle *bundle in self.imageBundles) {
|
||||
image = [UIImage imageNamed:imageName inBundle:bundle compatibleWithTraitCollection:nil];
|
||||
if (image) {
|
||||
break;
|
||||
__block UIImage *image = nil;
|
||||
dispatch_barrier_sync(self.imageCacheQueue, ^{
|
||||
for (NSBundle *bundle in self.imageBundles) {
|
||||
image = [UIImage imageNamed:imageName inBundle:bundle compatibleWithTraitCollection:nil];
|
||||
if (image) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
return image;
|
||||
}
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user