Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 9970bbac authored by Chris Craik's avatar Chris Craik Committed by Android Git Automerger
Browse files

am 3534e134: Merge "Avoid crash if onDetachedFromWindow called after destroy" into jb-dev

* commit '3534e134':
  Avoid crash if onDetachedFromWindow called after destroy
parents ddf573d6 3534e134
Loading
Loading
Loading
Loading
+15 −9
Original line number Diff line number Diff line
@@ -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();

        if (mWebView.isHardwareAccelerated()) {
            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()) {
            if (drawGLFunction != 0 && viewRoot != null) {
                viewRoot.detachFunctor(drawGLFunction);
            }
+1 −2
Original line number Diff line number Diff line
@@ -262,7 +262,6 @@ void OpenGLRenderer::resume() {
}

void OpenGLRenderer::detachFunctor(Functor* functor) {
    ALOGD("opengl renderer %p detaching functor %p", this, functor);
    mFunctors.remove(functor);
}

@@ -310,7 +309,7 @@ status_t OpenGLRenderer::invokeFunctors(Rect& dirty) {

status_t OpenGLRenderer::callDrawGLFunction(Functor* functor, Rect& dirty) {
    interrupt();
    mFunctors.remove(functor);
    detachFunctor(functor);

    if (mDirtyClip) {
        setScissorFromClip();