Prevent event flag use after delete in example HAL
Fixes: 323085916 Test: presubmit Change-Id: Ia455d7f83ff2b0056593eabf9f91359b97f9fc0b
This commit is contained in:
parent
31cf5e1b63
commit
b3cefe3a51
1 changed files with 2 additions and 0 deletions
|
@ -119,6 +119,8 @@ class Sensors : public BnSensors, public ISensorsEventCallback {
|
|||
|
||||
// Utility function to delete the Event Flag
|
||||
void deleteEventFlag() {
|
||||
// Hold the lock to ensure we don't delete the flag while it's being used in postEvents()
|
||||
std::lock_guard<std::mutex> lock(mWriteLock);
|
||||
if (mEventQueueFlag != nullptr) {
|
||||
status_t status = EventFlag::deleteEventFlag(&mEventQueueFlag);
|
||||
if (status != OK) {
|
||||
|
|
Loading…
Reference in a new issue