Permalink
Browse files

Made explicit setters synchronous

  • Loading branch information...
1 parent 2f28e29 commit 3a28755f90e3dda727268422d105a902058ecc6e Magnus Ernstsson committed Nov 4, 2010
Showing with 10 additions and 3 deletions.
  1. +10 −3 Impl/GravatarUIImageFactory.m
@@ -41,9 +41,15 @@ -(void)dealloc {
-(void)setConnection:(NSURLConnection *)newConnection {
- [connection cancel];
- [connection release];
- connection = [newConnection retain];
+ @synchronized(self) {
+
+ if (connection != newConnection) {
+
+ [connection cancel];
+ [connection release];
+ connection = [newConnection retain];
+ }
+ }
}
#pragma mark -
@@ -93,6 +99,7 @@ -(void)handleErrorWithCode:(GravatarServerError)code {
}
-(void)makeRequest:(NSString *)request {
+
NSURLRequest *theRequest = [NSURLRequest
requestWithURL:[NSURL URLWithString:request]
cachePolicy:NSURLRequestUseProtocolCachePolicy

0 comments on commit 3a28755

Please sign in to comment.