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

Commit 527ee91b authored by Romain Guy's avatar Romain Guy
Browse files

Prevent crash in WebView when disabling the hw renderer

Bug #6596807

A crash would occur in the following situation:
- WebView registers a functor with the hardware renderer
- The hardware renderer gets disabled
- WebView attemps to unregister its functor

Unregistering the functor fails because the hardware renderer is now disabled.
When the renderer becomes enabled again, the functor is invoked, which leads
to a native crash.

This change simply allows functors to always be unregistered, even when the
renderer is disabled. A disabled renderer only means that it will not be used
for rendering; as such, unregistering a functor is a valid operation and
should be allowed.

Change-Id: I0ff897a0cca7e048c609033215cd0f7f5c940bcc
parent a7e3a1e0
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -671,6 +671,7 @@ public final class ViewRootImpl implements ViewParent,
    }

    public boolean attachFunctor(int functor) {
        //noinspection SimplifiableIfStatement
        if (mAttachInfo.mHardwareRenderer != null && mAttachInfo.mHardwareRenderer.isEnabled()) {
            return mAttachInfo.mHardwareRenderer.attachFunctor(mAttachInfo, functor);
        }
@@ -678,7 +679,7 @@ public final class ViewRootImpl implements ViewParent,
    }

    public void detachFunctor(int functor) {
        if (mAttachInfo.mHardwareRenderer != null && mAttachInfo.mHardwareRenderer.isEnabled()) {
        if (mAttachInfo.mHardwareRenderer != null) {
            mAttachInfo.mHardwareRenderer.detachFunctor(functor);
        }
    }