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

Commit 02b693ec authored by Michael Kolb's avatar Michael Kolb Committed by Android (Google) Code Review
Browse files

Merge "fix race condition in WebViewClassic.destroy()"

parents c730aceb 6ddf44d8
Loading
Loading
Loading
Loading
+6 −0
Original line number Diff line number Diff line
@@ -155,6 +155,12 @@ class CallbackProxy extends Handler {
        mBackForwardList = new WebBackForwardList(this);
    }

    protected void shutdown() {
        setWebViewClient(null);
        setWebChromeClient(null);
        removeCallbacksAndMessages(null);
    }

    /**
     * Set the WebViewClient.
     * @param client An implementation of WebViewClient.
+0 −10
Original line number Diff line number Diff line
@@ -2121,10 +2121,6 @@ public final class WebViewClassic implements WebViewProvider, WebViewProvider.Sc
        }
        if (mNativeClass != 0) nativeStopGL();
        if (mWebViewCore != null) {
            // Set the handlers to null before destroying WebViewCore so no
            // more messages will be posted.
            mCallbackProxy.setWebViewClient(null);
            mCallbackProxy.setWebChromeClient(null);
            // Tell WebViewCore to destroy itself
            synchronized (this) {
                WebViewCore webViewCore = mWebViewCore;
@@ -2133,12 +2129,6 @@ public final class WebViewClassic implements WebViewProvider, WebViewProvider.Sc
            }
            // Remove any pending messages that might not be serviced yet.
            mPrivateHandler.removeCallbacksAndMessages(null);
            mCallbackProxy.removeCallbacksAndMessages(null);
            // Wake up the WebCore thread just in case it is waiting for a
            // JavaScript dialog.
            synchronized (mCallbackProxy) {
                mCallbackProxy.notify();
            }
        }
        if (mNativeClass != 0) {
            nativeDestroy();
+6 −0
Original line number Diff line number Diff line
@@ -1252,6 +1252,12 @@ public final class WebViewCore {
                            // Time to take down the world. Cancel all pending
                            // loads and destroy the native view and frame.
                            synchronized (WebViewCore.this) {
                                mCallbackProxy.shutdown();
                                // Wake up the WebCore thread just in case it is waiting for a
                                // JavaScript dialog.
                                synchronized (mCallbackProxy) {
                                    mCallbackProxy.notify();
                                }
                                mBrowserFrame.destroy();
                                mBrowserFrame = null;
                                mSettings.onDestroyed();