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

Commit 364d2dd1 authored by Yu-Ting Tseng's avatar Yu-Ting Tseng
Browse files

Avoid calling flushCommands in BpBinder::onLastStrongRef

BpBinder::onLastStrongRef calls removeFrozenStateChangeCallback which in turn calls flushCommands. This can cause BpBinder to be freed twice due
to this invocation chain: processPostWriteDerefs -> decStrong ->
onLastStrongRef -> removeFrozenStateChangeCallback -> talkWithDriver
-> processPostWriteDerefs -> decStrong. The recursive call to
processPostWriteDerefs causes decStrong to be called the second time erroneously on a BpBinder object.

This change fixes the issue by avoiding calling flushCommands in
removeFrozenStateChangeCallback when called from BpBinder::onLastStrongRef.

The behavior change is guarded behind flag
RELEASE_LIBBINDER_NO_FLUSH_ON_LAST_REF

Flag: build.RELEASE_LIBBINDER_NO_FLUSH_ON_LAST_REF
Bug: 430341301
Test: atest binderLibTest
Change-Id: Ic45b75a2b3ebb56c7a9c5ecfafcd8e95ab2e4405
parent 46222988
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment