From: Jay Freeman (saurik) Date: Mon, 7 Mar 2011 14:53:52 +0000 (-0800) Subject: Automate set{Delegate,DataSource}:nil using _H<>. X-Git-Tag: v1.1.0%b1~30 X-Git-Url: https://git.saurik.com/cydia.git/commitdiff_plain/bf7c998c9b68756e925462bbfe1f9a699fc5055b Automate set{Delegate,DataSource}:nil using _H<>. --- diff --git a/CyteKit/TableViewCell.h b/CyteKit/TableViewCell.h index 27fd6503..719b16bf 100644 --- a/CyteKit/TableViewCell.h +++ b/CyteKit/TableViewCell.h @@ -44,7 +44,7 @@ #include -#include +#include @protocol CyteTableViewCellDelegate - (void) drawContentRect:(CGRect)rect; @@ -57,7 +57,7 @@ @end @interface CYTableViewCell : UITableViewCell { - _H content_; + _H content_; bool highlighted_; } diff --git a/CyteKit/WebViewController.h b/CyteKit/WebViewController.h index 0954b38e..76bdd82d 100644 --- a/CyteKit/WebViewController.h +++ b/CyteKit/WebViewController.h @@ -46,7 +46,7 @@ #include #include -#include +#include @class IndirectDelegate; @@ -62,11 +62,11 @@ MFMailComposeViewControllerDelegate, UIWebViewDelegate > { - _transient CyteWebView *webview_; + _H webview_; _transient UIScrollView *scroller_; _H indicator_; - _H indirect_; + _H indirect_; _H challenge_; bool error_; diff --git a/CyteKit/WebViewController.mm b/CyteKit/WebViewController.mm index 03f0b95b..ca2f89ad 100644 --- a/CyteKit/WebViewController.mm +++ b/CyteKit/WebViewController.mm @@ -25,6 +25,9 @@ extern NSString * const kCAFilterNearest; #include #include +#include +#include + #define ForSaurik 0 #define DefaultTimeout_ 120.0 @@ -138,9 +141,6 @@ float CYScrollViewDecelerationRateNormal; NSLog(@"[CyteWebViewController dealloc]"); #endif - [webview_ setDelegate:nil]; - [indirect_ setDelegate:nil]; - if ([loading_ count] != 0) [delegate_ releaseNetworkActivityIndicator]; @@ -919,7 +919,7 @@ float CYScrollViewDecelerationRateNormal; } - (void) dispatchEvent:(NSString *)event { - [webview_ dispatchEvent:event]; + [(CyteWebView *) webview_ dispatchEvent:event]; } - (bool) hidesNavigationBar { diff --git a/Menes/ObjectHandle.h b/Menes/ObjectHandle.h index 716e6f44..cd01509c 100644 --- a/Menes/ObjectHandle.h +++ b/Menes/ObjectHandle.h @@ -40,7 +40,31 @@ #ifndef Menes_ObjectHandle_H #define Menes_ObjectHandle_H +template +struct MenesObjectHandle_; + template +struct MenesObjectHandle_ { + static _finline void Execute(Type_ *value) { + } +}; + +template +struct MenesObjectHandle_ { + static _finline void Execute(Type_ *value) { + [value setDelegate:nil]; + } +}; + +template +struct MenesObjectHandle_ { + static _finline void Execute(Type_ *value) { + [value setDelegate:nil]; + [value setDataSource:nil]; + } +}; + +template class MenesObjectHandle { private: Type_ *value_; @@ -51,8 +75,10 @@ class MenesObjectHandle { } _finline void Clear_() { - if (value_ != nil) + if (value_ != nil) { + MenesObjectHandle_::Execute(value_); CFRelease((CFTypeRef) value_); + } } public: diff --git a/MobileCydia.mm b/MobileCydia.mm index 92bce95c..4e0343a0 100644 --- a/MobileCydia.mm +++ b/MobileCydia.mm @@ -4896,7 +4896,7 @@ bool DepSubstrate(const pkgCache::VerIterator &iterator) { ProgressDelegate > { _transient Database *database_; - _H progress_; + _H progress_; unsigned cancel_; } @@ -4913,7 +4913,6 @@ bool DepSubstrate(const pkgCache::VerIterator &iterator) { - (void) dealloc { [database_ setProgressDelegate:nil]; - [progress_ setDelegate:nil]; [super dealloc]; } @@ -5511,7 +5510,7 @@ bool DepSubstrate(const pkgCache::VerIterator &iterator) { _H package_; _H name_; _H files_; - _H list_; + _H list_; } - (id) initWithDatabase:(Database *)database; @@ -5521,12 +5520,6 @@ bool DepSubstrate(const pkgCache::VerIterator &iterator) { @implementation FileTable -- (void) dealloc { - [(UITableView *) list_ setDataSource:nil]; - [list_ setDelegate:nil]; - [super dealloc]; -} - - (NSInteger) tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section { return files_ == nil ? 0 : [files_ count]; } @@ -5803,7 +5796,7 @@ bool DepSubstrate(const pkgCache::VerIterator &iterator) { unsigned era_; _H packages_; _H sections_; - _H list_; + _H list_; _H index_; _H indices_; _H title_; @@ -5819,12 +5812,6 @@ bool DepSubstrate(const pkgCache::VerIterator &iterator) { @implementation PackageListController -- (void) dealloc { - [list_ setDataSource:nil]; - [list_ setDelegate:nil]; - [super dealloc]; -} - - (bool) isSummarized { return false; } @@ -6467,7 +6454,7 @@ bool DepSubstrate(const pkgCache::VerIterator &iterator) { ProgressDelegate > { _transient Database *database_; - _H refreshbar_; + _H refreshbar_; bool dropped_; bool updating_; @@ -6546,7 +6533,6 @@ bool DepSubstrate(const pkgCache::VerIterator &iterator) { } - (void) dealloc { - [refreshbar_ setDelegate:nil]; [[NSNotificationCenter defaultCenter] removeObserver:self]; [super dealloc]; @@ -6932,7 +6918,7 @@ bool DepSubstrate(const pkgCache::VerIterator &iterator) { _transient Database *database_; _H sections_; _H filtered_; - _H list_; + _H list_; } - (id) initWithDatabase:(Database *)database; @@ -7134,7 +7120,7 @@ bool DepSubstrate(const pkgCache::VerIterator &iterator) { unsigned era_; _H packages_; _H sections_; - _H list_; + _H list_; unsigned upgrades_; } @@ -7365,7 +7351,7 @@ bool DepSubstrate(const pkgCache::VerIterator &iterator) { @interface SearchController : FilteredPackageListController < UISearchBarDelegate > { - _H search_; + _H search_; BOOL searchloaded_; } @@ -7376,11 +7362,6 @@ bool DepSubstrate(const pkgCache::VerIterator &iterator) { @implementation SearchController -- (void) dealloc { - [search_ setDelegate:nil]; - [super dealloc]; -} - - (NSURL *) navigationURL { if ([search_ text] == nil || [[search_ text] isEqualToString:@""]) return [NSURL URLWithString:@"cydia://search"]; @@ -7491,7 +7472,7 @@ bool DepSubstrate(const pkgCache::VerIterator &iterator) { _transient Database *database_; _H name_; _H package_; - _H table_; + _H table_; _H subscribedSwitch_; _H ignoredSwitch_; _H subscribedCell_; @@ -7677,10 +7658,6 @@ bool DepSubstrate(const pkgCache::VerIterator &iterator) { @implementation InstalledController -- (void) dealloc { - [super dealloc]; -} - - (NSURL *) navigationURL { return [NSURL URLWithString:@"cydia://installed"]; } @@ -7845,7 +7822,7 @@ bool DepSubstrate(const pkgCache::VerIterator &iterator) { UITableViewDelegate > { _transient Database *database_; - _H list_; + _H list_; _H sources_; int offset_; @@ -8286,7 +8263,7 @@ bool DepSubstrate(const pkgCache::VerIterator &iterator) { _transient Database *database_; // XXX: ok, "roledelegate_"?... _transient id roledelegate_; - _H table_; + _H table_; _H segment_; _H container_; }