mirror of
https://github.com/PX4/PX4-Autopilot.git
synced 2026-11-25 16:51:16 +08:00
fix(tone_alarm): cancel the end of the note when the driver stops
The driver ends each note with an HRT callout on its _hrt_call member. When the driver stopped while a note was playing, the callout stayed queued after the object was deleted, and the HRT then read the freed hrt_call at the end of the note and called InterruptStopNote() from it, or crashed if the memory had been reused. Assisted-by: Claude:opus-5.5 Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
This commit is contained in:
1 parent
5d6b1c2c67
commit
0ea6a82b3d
1 file changed
+2
@@ -51,6 +51,8 @@ ToneAlarm::ToneAlarm() :
|
||||
|
||||
ToneAlarm::~ToneAlarm()
|
||||
{
|
||||
// the end of the note would otherwise be called on the deleted driver
|
||||
hrt_cancel(&_hrt_call);
|
||||
ToneAlarmInterface::stop_note();
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user