From 26e6829b74dd3ae2fc50dba47f6721aedb6d6b34 Mon Sep 17 00:00:00 2001 From: "Jay Freeman (saurik)" Date: Sat, 19 Feb 2011 16:32:58 -0800 Subject: Entirely theoretical getInstalledPackages() threading bug: I'm anal. --- MobileCydia.mm | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'MobileCydia.mm') diff --git a/MobileCydia.mm b/MobileCydia.mm index bda674d..bfea21c 100644 --- a/MobileCydia.mm +++ b/MobileCydia.mm @@ -4004,13 +4004,15 @@ static NSString *Warning_; } - (NSArray *) getInstalledPackages { - NSArray *packages([[Database sharedInstance] packages]); + Database *database([Database sharedInstance]); +@synchronized (database) { + NSArray *packages([database packages]); NSMutableArray *installed([NSMutableArray arrayWithCapacity:1024]); for (Package *package in packages) - if ([package installed] != nil) + if (![package uninstalled]) [installed addObject:package]; return installed; -} +} } - (Package *) getPackageById:(NSString *)id { Package *package([[Database sharedInstance] packageWithName:id]); -- cgit v1.2.3