summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJay Freeman (saurik) <saurik@saurik.com>2011-02-19 16:32:58 -0800
committerJay Freeman (saurik) <saurik@saurik.com>2011-02-19 17:01:07 -0800
commit26e6829b74dd3ae2fc50dba47f6721aedb6d6b34 (patch)
treed0a276c802392ad2c3623618f2778736348c7fc8
parent6c0ea9c39cd316b4c15ad75bad35ccb8e3f17f22 (diff)
Entirely theoretical getInstalledPackages() threading bug: I'm anal.
-rw-r--r--MobileCydia.mm8
1 files changed, 5 insertions, 3 deletions
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]);