diff --git a/ios/sdk/base/HippyBridge.mm b/ios/sdk/base/HippyBridge.mm index e004c8ebeb7..75718266a8b 100644 --- a/ios/sdk/base/HippyBridge.mm +++ b/ios/sdk/base/HippyBridge.mm @@ -245,14 +245,16 @@ - (HippyNextAnimationModule *)animationModule { } - (NSSet> *)imageProviders { - if (!_imageProviders) { - NSMutableSet *set = [NSMutableSet setWithCapacity:8]; - for (Class moduleClass in self.moduleClasses) { - if ([moduleClass conformsToProtocol:@protocol(HippyImageProviderProtocol)]) { - [set addObject:moduleClass]; + @synchronized (self) { + if (!_imageProviders) { + NSMutableSet *set = [NSMutableSet set]; + for (Class moduleClass in self.moduleClasses) { + if ([moduleClass conformsToProtocol:@protocol(HippyImageProviderProtocol)]) { + [set addObject:moduleClass]; + } } + _imageProviders = [NSSet setWithSet:set]; } - _imageProviders = [NSSet setWithSet:set]; } return _imageProviders; }