]> git.saurik.com Git - cydia.git/commitdiff
Factor out -[Database releasePackages] and use from -[Database dealloc].
authorJay Freeman (saurik) <saurik@saurik.com>
Thu, 25 Nov 2010 23:49:24 +0000 (15:49 -0800)
committerJay Freeman (saurik) <saurik@saurik.com>
Thu, 25 Nov 2010 23:49:24 +0000 (15:49 -0800)
MobileCydia.mm

index c2a83db0630f90c14a2e2592dc8e137e982c17c4..b849f5ecc187ada7926aa60ebe41d789e2ab9d5a 100644 (file)
@@ -2914,12 +2914,17 @@ static NSString *Warning_;
     return era_;
 }
 
+- (void) releasePackages {
+    CFArrayApplyFunction(packages_, CFRangeMake(0, CFArrayGetCount(packages_)), reinterpret_cast<CFArrayApplierFunction>(&CFRelease), NULL);
+    CFArrayRemoveAllValues(packages_);
+}
+
 - (void) dealloc {
     // XXX: actually implement this thing
     _assert(false);
-    NSRecycleZone(zone_);
-    // XXX: malloc_destroy_zone(zone_);
+    [self releasePackages];
     apr_pool_destroy(pool_);
+    NSRecycleZone(zone_);
     [super dealloc];
 }
 
@@ -3207,9 +3212,7 @@ static NSString *Warning_;
 @synchronized (self) {
     ++era_;
 
-    CFArrayApplyFunction(packages_, CFRangeMake(0, CFArrayGetCount(packages_)), reinterpret_cast<CFArrayApplierFunction>(&CFRelease), NULL);
-    CFArrayRemoveAllValues(packages_);
-
+    [self releasePackages];
     sources_.clear();
 
     _error->Discard();