From 900095fdf69cc72c5a0d5b1f75c4451a0bc4440e Mon Sep 17 00:00:00 2001 From: "Jay Freeman (saurik)" Date: Thu, 24 Feb 2011 09:06:24 -0800 Subject: Simplify and correct memory management of SearchController. --- MobileCydia.mm | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/MobileCydia.mm b/MobileCydia.mm index 249439d..932cb89 100644 --- a/MobileCydia.mm +++ b/MobileCydia.mm @@ -7618,7 +7618,7 @@ bool DepSubstrate(const pkgCache::VerIterator &iterator) { @interface SearchController : FilteredPackageListController < UISearchBarDelegate > { - UISearchBar *search_; + _H search_; BOOL searchloaded_; } @@ -7631,7 +7631,7 @@ bool DepSubstrate(const pkgCache::VerIterator &iterator) { @implementation SearchController - (void) dealloc { - [search_ release]; + [search_ setDelegate:nil]; [super dealloc]; } @@ -7660,7 +7660,8 @@ bool DepSubstrate(const pkgCache::VerIterator &iterator) { - (id) initWithDatabase:(Database *)database { if ((self = [super initWithDatabase:database title:UCLocalize("SEARCH") filter:@selector(isUnfilteredAndSearchedForBy:) with:nil])) { - search_ = [[UISearchBar alloc] init]; + search_ = [[[UISearchBar alloc] init] autorelease]; + [search_ setDelegate:self]; } return self; } @@ -7680,7 +7681,6 @@ bool DepSubstrate(const pkgCache::VerIterator &iterator) { textField = MSHookIvar(search_, "_searchField"); [textField setAutoresizingMask:UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleTopMargin | UIViewAutoresizingFlexibleBottomMargin]; - [search_ setDelegate:self]; [textField setEnablesReturnKeyAutomatically:NO]; [[self navigationItem] setTitleView:textField]; } -- cgit v1.2.3