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

Commit 3fb4b7bb authored by Robin Lee's avatar Robin Lee Committed by Pablo Gamito
Browse files

Use stable objects for callbacks

Fixes a memory leak contributing to b/419430883.

In Android's Runtime, method references are not stable across callsites.

Concretely If you register (this::fun) and unregister (this::fun), this
may lead to twice as much fun as you bargained for. The lambda instances
generated for register and unregister are NOT equal!

This leads to memory leaks as the registration works but the
deregistration is not recognised, leading to everlasting fun.

Bug: 419430883
Test: atest WMShellUnitTests # sufficiently large to trigger the leak
Flag: android.tracing.client_side_proto_logging
Change-Id: Idc478fdf60985d86144e9ec317b198a038f60b1e
parent 674ca99d
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