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

Commit e9b4f146 authored by Hani Kazmi's avatar Hani Kazmi
Browse files

Fix a race condition in BaseBundle.

This CL fixes the race condition by ensuring that the parcel is not garbage collected after it's state has been checked

Change-Id: I59a1e4d1df44f123b6134665978c9a6c44be0710
Test: Presubmit tests
Bug: 324903437
parent a65fd3de
Loading
Loading
Loading
Loading
+3 −4
Original line number Diff line number Diff line
@@ -429,10 +429,9 @@ public class BaseBundle {
                        "Lazy values ref count below 0");
                // No more lazy values in mMap, so we can recycle the parcel early rather than
                // waiting for the next GC run
                if (mLazyValues == 0) {
                    Preconditions.checkState(mWeakParcelledData.get() != null,
                            "Parcel recycled earlier than expected");
                    recycleParcel(mWeakParcelledData.get());
                Parcel parcel = mWeakParcelledData.get();
                if (mLazyValues == 0 && parcel != null) {
                    recycleParcel(parcel);
                    mWeakParcelledData = null;
                }
            }