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

Commit 408dc961 authored by Steven Thomas's avatar Steven Thomas
Browse files

Fix IllegalArgumentException from Surface.release()

ag/9659388 introduced a problem where calling Surface.release() would
possibly result in an IllegalArgumentException. Fix the order of
deletions in release() to avoid this.

Bug: 144862317
Test: Ran a cts test that was failing with the exception, confirmed it
      no longer fails with this CL in place.

Change-Id: Ib3fa67d49457aee304512642afe34ed6a887e6eb
parent 43361f71
Loading
Loading
Loading
Loading
+4 −4
Original line number Diff line number Diff line
@@ -258,14 +258,14 @@ public class Surface implements Parcelable {
     */
    public void release() {
        synchronized (mLock) {
            if (mNativeObject != 0) {
                nativeRelease(mNativeObject);
                setNativeObjectLocked(0);
            }
            if (mHwuiContext != null) {
                mHwuiContext.destroy();
                mHwuiContext = null;
            }
            if (mNativeObject != 0) {
                nativeRelease(mNativeObject);
                setNativeObjectLocked(0);
            }
        }
    }