summaryrefslogtreecommitdiff
path: root/UICaboodle
diff options
context:
space:
mode:
authorJay Freeman (saurik) <saurik@saurik.com>2009-04-20 22:36:30 +0000
committerJay Freeman (saurik) <saurik@saurik.com>2010-09-30 07:13:14 +0000
commit7592e053104ea95feef772e6a861d0f54b500b3a (patch)
tree80a1a9ded602eaae980b515c23053500f61b2842 /UICaboodle
parentf9f6d9e8294ce7c2d9db87c9834e6dfd3f43d069 (diff)
Various stability issues.
Diffstat (limited to 'UICaboodle')
-rw-r--r--UICaboodle/BrowserView.m27
1 files changed, 18 insertions, 9 deletions
diff --git a/UICaboodle/BrowserView.m b/UICaboodle/BrowserView.m
index b0b04fb..10cc193 100644
--- a/UICaboodle/BrowserView.m
+++ b/UICaboodle/BrowserView.m
@@ -574,8 +574,7 @@
- (void) webView:(WebView *)sender runJavaScriptAlertPanelWithMessage:(NSString *)message initiatedByFrame:(WebFrame *)frame {
if (![self _allowJavaScriptPanel])
return;
-
- // WTR: [self retain];
+ [self retain];
UIActionSheet *sheet = [[[UIActionSheet alloc]
initWithTitle:nil
@@ -592,6 +591,7 @@
- (BOOL) webView:(WebView *)sender runJavaScriptConfirmPanelWithMessage:(NSString *)message initiatedByFrame:(WebFrame *)frame {
if (![self _allowJavaScriptPanel])
return NO;
+ [self retain];
UIActionSheet *sheet = [[[UIActionSheet alloc]
initWithTitle:nil
@@ -612,6 +612,8 @@
NSNumber *confirm([confirm_ autorelease]);
confirm_ = nil;
+
+ [self autorelease];
return [confirm boolValue];
}
@@ -1005,7 +1007,9 @@
}
- (void) webView:(WebView *)sender didStartProvisionalLoadForFrame:(WebFrame *)frame {
- [loading_ addObject:frame];
+ if ([loading_ count] == 0)
+ [self retain];
+ [loading_ addObject:[NSValue valueWithNonretainedObject:frame]];
if ([frame parentFrame] == nil) {
[webview_ resignFirstResponder];
@@ -1065,7 +1069,10 @@
}
- (void) _finishLoading {
- if (reloading_ || [loading_ count] != 0)
+ size_t count([loading_ count]);
+ if (count == 0)
+ [self autorelease];
+ if (reloading_ || count != 0)
return;
if (finish_ != nil)
[self callFunction:finish_];
@@ -1106,8 +1113,7 @@
}
- (void) webView:(WebView *)sender didFinishLoadForFrame:(WebFrame *)frame {
- [loading_ removeObject:frame];
-
+ [loading_ removeObject:[NSValue valueWithNonretainedObject:frame]];
[self _finishLoading];
if ([frame parentFrame] == nil) {
@@ -1156,12 +1162,15 @@
}
- (void) _didFailWithError:(NSError *)error forFrame:(WebFrame *)frame {
- [loading_ removeObject:frame];
- if (reloading_)
- return;
+ if ([frame parentFrame] == nil)
+ [self autorelease];
+ [loading_ removeObject:[NSValue valueWithNonretainedObject:frame]];
[self _finishLoading];
+ if (reloading_)
+ return;
+
if ([frame parentFrame] == nil) {
[self loadURL:[NSURL URLWithString:[NSString stringWithFormat:@"%@?%@",
[[NSURL fileURLWithPath:[[NSBundle mainBundle] pathForResource:@"error" ofType:@"html"]] absoluteString],