From: Jay Freeman (saurik) Date: Tue, 25 Nov 2014 23:50:26 +0000 (-0800) Subject: Use @synchronized() to guard Bundles_ (old crash). X-Git-Tag: v0.9.3916~15 X-Git-Url: https://git.saurik.com/winterboard.git/commitdiff_plain/95b8e8868da0c83b145587773a090ae689133747 Use @synchronized() to guard Bundles_ (old crash). --- diff --git a/Library.mm b/Library.mm index 0e69b91..0479b3e 100644 --- a/Library.mm +++ b/Library.mm @@ -434,7 +434,11 @@ static NSString *$pathForIcon$(SBApplication *self, NSString *suffix = @"") { if (path == nil || [path length] == 0 || [path isEqualToString:@"/"]) return nil; - NSBundle *bundle([Bundles_ objectForKey:path]); + NSBundle *bundle; + @synchronized (Bundles_) { + bundle = [Bundles_ objectForKey:path]; + } + if (reinterpret_cast(bundle) == [NSNull null]) return nil; else if (bundle == nil) { @@ -444,7 +448,10 @@ static NSString *$pathForIcon$(SBApplication *self, NSString *suffix = @"") { bundle = [NSBundle wb$bundleWithFile:path]; if (Debug_) NSLog(@"WB:Debug:PathBundle(%@, %@)", path, bundle); - [Bundles_ setObject:(bundle == nil ? [NSNull null] : reinterpret_cast(bundle)) forKey:path]; + + @synchronized (Bundles_) { + [Bundles_ setObject:(bundle == nil ? [NSNull null] : reinterpret_cast(bundle)) forKey:path]; + } } return bundle;