Fix a monkey crash when the new WebView is destroyed.

Grab the WebViewCore immediately so that if the Tab is destroyed, we have the
old WebViewCore object and can return the BrowserFrame.

Bug: 2733004
Change-Id: Ic3e4c5417f2165f412f60f05aea3ed403d8cecfd
This commit is contained in:
Patrick Scott
2010-06-16 12:27:06 -04:00
parent edb20ac70e
commit 97147286d1
2 changed files with 10 additions and 8 deletions

View File

@@ -800,11 +800,7 @@ class BrowserFrame extends Handler {
* @return The BrowserFrame object stored in the new WebView.
*/
private BrowserFrame createWindow(boolean dialog, boolean userGesture) {
WebView w = mCallbackProxy.createWindow(dialog, userGesture);
if (w != null) {
return w.getWebViewCore().getBrowserFrame();
}
return null;
return mCallbackProxy.createWindow(dialog, userGesture);
}
/**

View File

@@ -1144,7 +1144,7 @@ class CallbackProxy extends Handler {
}
}
public WebView createWindow(boolean dialog, boolean userGesture) {
public BrowserFrame createWindow(boolean dialog, boolean userGesture) {
// Do an unsynchronized quick check to avoid posting if no callback has
// been set.
if (mWebChromeClient == null) {
@@ -1168,9 +1168,15 @@ class CallbackProxy extends Handler {
WebView w = transport.getWebView();
if (w != null) {
w.getWebViewCore().initializeSubwindow();
WebViewCore core = w.getWebViewCore();
// If WebView.destroy() has been called, core may be null. Skip
// initialization in that case and return null.
if (core != null) {
core.initializeSubwindow();
return core.getBrowserFrame();
}
}
return w;
return null;
}
public void onRequestFocus() {