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:
Benjamin Cabé authored and Ramon Roche committed 2026-10-14 12:07:52 +02:00
1 parent 5d6b1c2c67
commit 0ea6a82b3d
1 file changed
+2
+2
View File
@@ -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();
}