From: Jay Freeman (saurik) Date: Thu, 25 Nov 2010 23:49:24 +0000 (-0800) Subject: Factor out -[Database releasePackages] and use from -[Database dealloc]. X-Git-Tag: v1.1.0%b1~485 X-Git-Url: https://git.saurik.com/cydia.git/commitdiff_plain/0944377bb2304a84195f37bed37d59bb2762dad6 Factor out -[Database releasePackages] and use from -[Database dealloc]. --- diff --git a/MobileCydia.mm b/MobileCydia.mm index c2a83db0..b849f5ec 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();