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

Skip to content
Commit 6e592063 authored by Chavi Weingarten's avatar Chavi Weingarten
Browse files

Use strong reference to parent Handle when creating layer

If LayerCreatedState holds a weak reference to the parent handle
the following can occur:
1. handleLayerCreatedLocked is called and promotes the handle to
a strong ref.

2. The client reference to that layer is removed.

3. When handleLayerCreatedLocked returns, the last reference is
dropped. The Handle dtor is called which then calls
onHandleDestroyed. That function tries to acquire the lock, but
it's already held by the caller.

4. This will cause a deadlock.

Instead, hold a strong reference in the LayerCreatedState. The
reference will be held until flushTransactionQueues finishes,
which will then clear the Handle reference. This occurs outside
the lock so there should be no issue

Fixes: 202621651
Test: Hard to reproduce, but no other issues
Change-Id: I0b1ea54b63cbdef1fcf96eedffa4fbfa6959f697
parent 5feba92d
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