CB-4995 Fix crash when WebView is quickly opened then closed.

Also fixes a leak where callback was never being cleared.
This commit is contained in:
Andrew Grieve 2013-10-21 13:16:54 -04:00
parent c7972b6cff
commit aa81c3267a

View File

@ -56,12 +56,8 @@
- (void)close:(CDVInvokedUrlCommand*)command
{
if (self.inAppBrowserViewController != nil) {
// Things are cleaned up in browserExit.
[self.inAppBrowserViewController close];
self.inAppBrowserViewController = nil;
}
self.callbackId = nil;
}
- (BOOL) isSystemUrl:(NSURL*)url
@ -372,10 +368,11 @@
if (self.callbackId != nil) {
CDVPluginResult* pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK
messageAsDictionary:@{@"type":@"exit"}];
[pluginResult setKeepCallback:[NSNumber numberWithBool:YES]];
[self.commandDelegate sendPluginResult:pluginResult callbackId:self.callbackId];
self.callbackId = nil;
}
// Set navigationDelegate to nil to ensure no callbacks are received from it.
self.inAppBrowserViewController.navigationDelegate = nil;
// Don't recycle the ViewController since it may be consuming a lot of memory.
// Also - this is required for the PDF/User-Agent bug work-around.
self.inAppBrowserViewController = nil;