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

Commit 8ac1c4a0 authored by Patrick Williams's avatar Patrick Williams
Browse files

Copy transaction in applyTransactionOnDraw

This prevents a race where the transaction is copied in the RenderThread
while simultaneously applied in another thread.

Bug: 273911227
Test: presubmits
Change-Id: I6d5345ae0c5d998010e0d3c3f33813190b1ea8de
parent 77fd0393
Loading
Loading
Loading
Loading
+5 −1
Original line number Diff line number Diff line
@@ -11365,9 +11365,13 @@ public final class ViewRootImpl implements ViewParent,
        if (mRemoved || !isHardwareEnabled()) {
            t.apply();
        } else {
            // Copy and clear the passed in transaction for thread safety. The new transaction is
            // accessed on the render thread.
            var localTransaction = new Transaction();
            localTransaction.merge(t);
            mHasPendingTransactions = true;
            registerRtFrameCallback(frame -> {
                mergeWithNextTransaction(t, frame);
                mergeWithNextTransaction(localTransaction, frame);
            });
        }
        return true;