diff options
author | Jay Freeman (saurik) <saurik@saurik.com> | 2011-02-20 04:40:52 -0800 |
---|---|---|
committer | Jay Freeman (saurik) <saurik@saurik.com> | 2011-02-20 04:41:09 -0800 |
commit | ed637e66d7f4af4b8f81fc897f89a0775cb957f6 (patch) | |
tree | 4a12fc2b82d8d841452bab95c92f252919501ef2 | |
parent | 2cd1afd9692214352f439b52dbb225b0a83ebb6a (diff) |
Refactor _detachNewThreadData as _detachNewThreadInvocation.
-rw-r--r-- | MobileCydia.mm | 20 |
1 files changed, 8 insertions, 12 deletions
diff --git a/MobileCydia.mm b/MobileCydia.mm index 48163b0..c7c9ab4 100644 --- a/MobileCydia.mm +++ b/MobileCydia.mm @@ -4811,7 +4811,6 @@ bool DepSubstrate(const pkgCache::VerIterator &iterator) { - (id) initWithDatabase:(Database *)database delegate:(id)delegate; - (void) _retachThread; -- (void) _detachNewThreadData:(ProgressData *)data; - (void) detachNewThreadSelector:(SEL)selector toTarget:(id)target withObject:(id)object title:(NSString *)title; - (BOOL) isRunning; @@ -5036,8 +5035,8 @@ bool DepSubstrate(const pkgCache::VerIterator &iterator) { [delegate_ setStatusBarShowsProgress:NO]; } -- (void) _detachNewThreadData:(ProgressData *)data { _pooled - [[data target] performSelector:[data selector] withObject:[data object]]; +- (void) _detachNewThreadInvocation:(NSInvocation *)invocation { _pooled + [invocation invoke]; [self performSelectorOnMainThread:@selector(_retachThread) withObject:nil waitUntilDone:YES]; } @@ -5088,15 +5087,12 @@ bool DepSubstrate(const pkgCache::VerIterator &iterator) { } } - [NSThread - detachNewThreadSelector:@selector(_detachNewThreadData:) - toTarget:self - withObject:[[[ProgressData alloc] - initWithSelector:selector - target:target - object:object - ] autorelease] - ]; + NSInvocation *invocation([NSInvocation invocationWithMethodSignature:[target methodSignatureForSelector:selector]]); + [invocation setTarget:target]; + [invocation setSelector:selector]; + _assert(object == nil); + + [NSThread detachNewThreadSelector:@selector(_detachNewThreadInvocation:) toTarget:self withObject:invocation]; } - (void) repairWithSelector:(SEL)selector { |