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

Commit 27e0bf62 authored by Romain Guy's avatar Romain Guy
Browse files

Safely dispose of the resize buffer

We just ensure there is a valid EGL context before
we destroy the associated layer.
parent 16ea8d37
Loading
Loading
Loading
Loading
+9 −5
Original line number Diff line number Diff line
@@ -923,10 +923,15 @@ public final class ViewRootImpl implements ViewParent,
    }

    void disposeResizeBuffer() {
        if (mResizeBuffer != null) {
        if (mResizeBuffer != null && mAttachInfo.mHardwareRenderer != null) {
            mAttachInfo.mHardwareRenderer.safelyRun(new Runnable() {
                @Override
                public void run() {
                    mResizeBuffer.destroy();
                    mResizeBuffer = null;
                }
            });
        }
    }

    /**
@@ -1466,8 +1471,7 @@ public final class ViewRootImpl implements ViewParent,
                            if (mResizeBuffer != null) {
                                mResizeBuffer.end(hwRendererCanvas);
                                if (!completed) {
                                    mResizeBuffer.destroy();
                                    mResizeBuffer = null;
                                    disposeResizeBuffer();
                                }
                            }
                        }