am 1d22e122: Merge "Fix a monkey crash when the new WebView is destroyed."

Merge commit '1d22e122a6f278a432519673a8ad3e4853934461' into gingerbread-plus-aosp

* commit '1d22e122a6f278a432519673a8ad3e4853934461':
  Fix a monkey crash when the new WebView is destroyed.
This commit is contained in:
Jean-Baptiste Queru
2010-08-30 15:21:51 -07:00
committed by Android Git Automerger
2 changed files with 10 additions and 8 deletions

View File

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

View File

@@ -1098,7 +1098,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 // Do an unsynchronized quick check to avoid posting if no callback has
// been set. // been set.
if (mWebChromeClient == null) { if (mWebChromeClient == null) {
@@ -1122,9 +1122,15 @@ class CallbackProxy extends Handler {
WebView w = transport.getWebView(); WebView w = transport.getWebView();
if (w != null) { 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() { public void onRequestFocus() {