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

Skip to content
Commit bb353da6 authored by Jakub Pawlowski's avatar Jakub Pawlowski
Browse files

Use weak pointer when refering to AdvertisingManager

In btif layer, we schedule tasks for execution on
AdvertisingManager on bta thread. Before the scheduling we check if
AdvertisingManager is initialized. We don't check if AdvertisingManager
is still valid, when the command execution is starting on the bta thread.
This is a race condition, that can cause crashes.

To fix that, always post task for execution using weak reference, rather
than raw pointer. Thanks to it, the MessageLoop will check if the
weak_ptr is valid before attempt to execute the task. The check happens
on the target thread, right before the execution, eliminating all
possible race conditions.

Test: ran all advertising tests, no regression
Bug: 71051865
Change-Id: I7fd8255879d5272d47aa79974bb79bdaacb55800
parent 354e911c
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