summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Cydia.mm33
-rw-r--r--UICaboodle/BrowserView.m27
2 files changed, 41 insertions, 19 deletions
diff --git a/Cydia.mm b/Cydia.mm
index a0df37c..e10a7d5 100644
--- a/Cydia.mm
+++ b/Cydia.mm
@@ -7204,7 +7204,7 @@ bool DepSubstrate(const pkgCache::VerIterator &iterator) {
ManageView *manage_;
SearchView *search_;
- PackageView *package_;
+ NSMutableArray *details_;
}
@end
@@ -7584,19 +7584,30 @@ bool DepSubstrate(const pkgCache::VerIterator &iterator) {
}
- (void) setPackageView:(PackageView *)view {
- if (package_ == nil)
- package_ = [view retain];
+ WebThreadLock();
+ [view setPackage:nil];
+ if ([details_ count] < 3)
+ [details_ addObject:view];
+ WebThreadUnlock();
+}
+
+- (PackageView *) _packageView {
+ return [[[PackageView alloc] initWithBook:book_ database:database_] autorelease];
}
- (PackageView *) packageView {
PackageView *view;
+ size_t count([details_ count]);
- if (package_ == nil)
- view = [[[PackageView alloc] initWithBook:book_ database:database_] autorelease];
- else {
- return package_;
- view = [package_ autorelease];
- package_ = nil;
+ if (count == 0) {
+ view = [self _packageView];
+ renew:
+ [details_ addObject:[self _packageView]];
+ } else {
+ view = [[[details_ lastObject] retain] autorelease];
+ [details_ removeLastObject];
+ if (count == 1)
+ goto renew;
}
return view;
@@ -7734,7 +7745,9 @@ bool DepSubstrate(const pkgCache::VerIterator &iterator) {
withClass:[ManageView class]
] retain];
- [self setPackageView:[self packageView]];
+ details_ = [[NSMutableArray alloc] initWithCapacity:4];
+ [details_ addObject:[self _packageView]];
+ [details_ addObject:[self _packageView]];
PrintTimes();
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],