File tree 3 files changed +41
-26
lines changed
3 files changed +41
-26
lines changed Original file line number Diff line number Diff line change 232
232
A494CC2B0F9F2446007D5EEB /* ctf.icns */,
233
233
D9566C2B0F37EA0800358646 /* deSIFR Resources */,
234
234
);
235
+ indentWidth = 4;
235
236
name = Plugin;
236
237
sourceTree = "<group>";
238
+ tabWidth = 4;
237
239
};
238
240
55EB70550E04A8A40016593D /* Frameworks */ = {
239
241
isa = PBXGroup;
Original file line number Diff line number Diff line change @@ -36,7 +36,9 @@ - (NSHTTPURLResponse *)getURLResponseHeaders:(NSURL *)URL
36
36
[request release ];
37
37
38
38
[theLock lockWhenCondition: 1 ];
39
+ [theLock unlock ];
39
40
if (error) (*error) = errorToReturn;
41
+
40
42
41
43
return [responseToReturn autorelease ];
42
44
}
@@ -53,34 +55,37 @@ + (NSHTTPURLResponse *)getURLResponseHeaders:(NSURL *)URL
53
55
54
56
- (void )startRequest : (NSURLRequest *)request ;
55
57
{
56
-
57
58
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc ] init ];
58
- [request retain ];
59
59
60
60
NSURLConnection *connection = [[NSURLConnection alloc ] initWithRequest: request
61
61
delegate: self
62
62
startImmediately: YES ];
63
- [[NSRunLoop currentRunLoop ] run ];
63
+
64
+ NSRunLoop *rl = [NSRunLoop currentRunLoop ];
65
+
66
+ while ([rl runMode: NSDefaultRunLoopMode beforeDate: [NSDate distantFuture ]]) {
67
+ if ([theLock tryLockWhenCondition: 1 ]) {
68
+ [theLock unlock ];
69
+ break ;
70
+ }
71
+ }
72
+
64
73
[connection release ];
65
74
66
- [request release ];
67
75
[pool drain ];
68
-
69
76
}
70
77
71
78
- (void )connection : (NSURLConnection *)connection didFailWithError : (NSError *)error ;
72
79
{
73
-
74
- [theLock tryLock ];
80
+ [theLock lock ];
75
81
76
82
errorToReturn = error;
77
83
[theLock unlockWithCondition: 1 ];
78
84
}
79
85
80
86
- (void )connection : (NSURLConnection *)connection didReceiveResponse : (NSHTTPURLResponse *)theResponse ;
81
87
{
82
-
83
- [theLock tryLock ];
88
+ [theLock lock ];
84
89
85
90
// we cancel here, because otherwise NSURLConnection will continue to download
86
91
// data due to a bug; even though we made a HEAD request, it still downloads
@@ -93,8 +98,7 @@ - (void)connection:(NSURLConnection *)connection didReceiveResponse:(NSHTTPURLRe
93
98
94
99
- (void )connectionDidFinishLoading : (NSURLConnection *)connection ;
95
100
{
96
-
97
- [theLock tryLock ];
101
+ [theLock lock ];
98
102
99
103
[theLock unlockWithCondition: 1 ];
100
104
}
Original file line number Diff line number Diff line change @@ -381,26 +381,35 @@ - (id) initWithArguments:(NSDictionary *)arguments
381
381
return self;
382
382
}
383
383
384
- - (void ) dealloc
384
+ - (void )webPlugInDestroy
385
385
{
386
- [self _removeTrackingAreaForCTF ];
387
- [NSObject cancelPreviousPerformRequestsWithTarget: self ];
386
+ [self _removeTrackingAreaForCTF ];
387
+ [NSObject cancelPreviousPerformRequestsWithTarget: self ];
388
388
389
389
[self _abortAlert ]; // to be on the safe side
390
390
391
391
// notify that this ClickToFlash plugin is going away
392
- [[CTFMenubarMenuController sharedController ] unregisterView: self ];
393
-
394
- [self setContainer: nil ];
395
- [self setHost: nil ];
396
- [self setWebView: nil ];
397
- [self setBaseURL: nil ];
398
- [self setAttributes: nil ];
399
-
400
- [_flashVars release ];
401
- [_badgeText release ];
402
-
403
- [[NSNotificationCenter defaultCenter ] removeObserver: self ];
392
+ [[CTFMenubarMenuController sharedController ] unregisterView: self ];
393
+
394
+ [self setContainer: nil ];
395
+ [self setHost: nil ];
396
+ [self setWebView: nil ];
397
+ [self setBaseURL: nil ];
398
+ [self setAttributes: nil ];
399
+
400
+ [_flashVars release ];
401
+ _flashVars = nil ;
402
+ [_badgeText release ];
403
+ _badgeText = nil ;
404
+
405
+ [[NSNotificationCenter defaultCenter ] removeObserver: self ];
406
+ }
407
+
408
+ - (void ) dealloc
409
+ {
410
+ // Just in case...
411
+ [self webPlugInDestroy ];
412
+
404
413
#if LOGGING_ENABLED
405
414
NSLog (@" ClickToFlash:\t dealloc" );
406
415
#endif
You can’t perform that action at this time.
0 commit comments