From 0944377bb2304a84195f37bed37d59bb2762dad6 Mon Sep 17 00:00:00 2001 From: "Jay Freeman (saurik)" Date: Thu, 25 Nov 2010 15:49:24 -0800 Subject: Factor out -[Database releasePackages] and use from -[Database dealloc]. --- MobileCydia.mm | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/MobileCydia.mm b/MobileCydia.mm index c2a83db..b849f5e 100644 --- a/MobileCydia.mm +++ b/MobileCydia.mm @@ -2914,12 +2914,17 @@ static NSString *Warning_; return era_; } +- (void) releasePackages { + CFArrayApplyFunction(packages_, CFRangeMake(0, CFArrayGetCount(packages_)), reinterpret_cast(&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(&CFRelease), NULL); - CFArrayRemoveAllValues(packages_); - + [self releasePackages]; sources_.clear(); _error->Discard(); -- cgit v1.2.3