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

Skip to content
Commit 96b96ee2 authored by Jeremy Wu's avatar Jeremy Wu
Browse files

Floss: access message_loop_thread_ only via worker thread

|RepeatingTimer|s hold a weak pointer to the static worker thread
|btif_a2dp_source_thread|, and is only meant to dereference it on the
same thread (as the worker thread).

However, there is much of abusing its ownership, trying to dereference
it from either the main thread or uipc thread, for the sake of using it
as a condition to determine if audio is streaming. This alone is prone
to race conditions, and causes immediate crashes thrown by libchrome.

In this CL, we ensure dereference of the weak pointer in question is
only invoked via the worker thread:

- Let |btif_a2dp_source_audio_tx_stop_event|, the worker thread
  function, decide if it |is_streaming|
- Remove redundant calls to |media_alarm.IsScheduled|
- Remove |is_streaming| checks that are not necessary

Bug: 257166696
Tag: #floss
Test: Build and verify
Change-Id: Ibdfa24ce10b254b8ac5717b7ca64e95bf933f832
parent f9ce5d9c
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