diff options
| author | Chris Craik <ccraik@google.com> | 2012-05-22 17:20:07 -0700 |
|---|---|---|
| committer | Android (Google) Code Review <android-gerrit@google.com> | 2012-05-22 17:20:07 -0700 |
| commit | 3534e13486a0081b1229e698f13bd3a37efa3fb0 (patch) | |
| tree | c2efe65a2e556c6559745e41e7379e8d9435e805 /core/java/android/webkit/WebViewClassic.java | |
| parent | 2d243bc62a899f7af77886a2a2a82872d63226bb (diff) | |
| parent | 9e08012869f77f212186a5d5856831a85fb73d40 (diff) | |
Merge "Avoid crash if onDetachedFromWindow called after destroy" into jb-dev
Diffstat (limited to 'core/java/android/webkit/WebViewClassic.java')
| -rw-r--r-- | core/java/android/webkit/WebViewClassic.java | 24 |
1 files changed, 15 insertions, 9 deletions
diff --git a/core/java/android/webkit/WebViewClassic.java b/core/java/android/webkit/WebViewClassic.java index 30b7d6331134..58dd82ec2685 100644 --- a/core/java/android/webkit/WebViewClassic.java +++ b/core/java/android/webkit/WebViewClassic.java @@ -2069,11 +2069,20 @@ public final class WebViewClassic implements WebViewProvider, WebViewProvider.Sc } private void destroyImpl() { - int drawGLFunction = nativeGetDrawGLFunction(mNativeClass); ViewRootImpl viewRoot = mWebView.getViewRootImpl(); - Log.d(LOGTAG, String.format("destroyImpl, functor %x, viewroot == null %b, isHWAccel %b", - drawGLFunction, (viewRoot == null), - mWebView.isHardwareAccelerated())); + if (viewRoot != null) { + Log.e(LOGTAG, "Error: WebView.destroy() called while still attached!"); + } + + if (mWebView.isHardwareAccelerated()) { + int drawGLFunction = nativeGetDrawGLFunction(mNativeClass); + if (drawGLFunction != 0 && viewRoot != null) { + // functor should have been detached in onDetachedFromWindow, do + // additionally here for safety + viewRoot.detachFunctor(drawGLFunction); + } + } + mCallbackProxy.blockMessages(); clearHelpers(); if (mListBoxDialog != null) { @@ -5301,12 +5310,9 @@ public final class WebViewClassic implements WebViewProvider, WebViewProvider.Sc updateHwAccelerated(); - int drawGLFunction = nativeGetDrawGLFunction(mNativeClass); - ViewRootImpl viewRoot = mWebView.getViewRootImpl(); - Log.d(LOGTAG, String.format("destroyImpl, functor %x, viewroot == null %b, isHWAccel %b", - drawGLFunction, (viewRoot == null), - mWebView.isHardwareAccelerated())); if (mWebView.isHardwareAccelerated()) { + int drawGLFunction = nativeGetDrawGLFunction(mNativeClass); + ViewRootImpl viewRoot = mWebView.getViewRootImpl(); if (drawGLFunction != 0 && viewRoot != null) { viewRoot.detachFunctor(drawGLFunction); } |
