Permalink
Browse files

use GCD to expire proxy objects

  • Loading branch information...
1 parent b4665ae commit 0e24f2989e68e6eb55c88fe01b3bd6c695a48a94 @skurfer committed Dec 4, 2012
Showing with 4 additions and 1 deletion.
  1. +4 −1 Quicksilver/Code-QuickStepCore/QSProxyObject.m
@@ -78,7 +78,10 @@ - (QSObject*)proxyObject {
if ([provider respondsToSelector:@selector(cacheTimeForProxy:)])
interval = [[self proxyProvider] cacheTimeForProxy:self];
- [NSTimer scheduledTimerWithTimeInterval:interval target:self selector:@selector(releaseProxy) userInfo:nil repeats:NO];
+ dispatch_time_t popTime = dispatch_time(DISPATCH_TIME_NOW, (int64_t)interval * NSEC_PER_SEC);
+ dispatch_after(popTime, dispatch_get_main_queue(), ^(void){
+ [self releaseProxy];
+ });
return proxy;
}

0 comments on commit 0e24f29

Please sign in to comment.