From 9d557afe2629885869c6755139863bd529517a04 Mon Sep 17 00:00:00 2001 From: Jack Date: Tue, 19 Nov 2019 22:55:25 +0800 Subject: [PATCH] esp_timer: fix the bug that when timeout of timer happens try to run callback, and high priority task delete the timer and break the callback --- components/esp32/esp_timer.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/components/esp32/esp_timer.c b/components/esp32/esp_timer.c index 78f004acf..3f5ff2e16 100644 --- a/components/esp32/esp_timer.c +++ b/components/esp32/esp_timer.c @@ -286,8 +286,10 @@ static void timer_process_alarm(esp_timer_dispatch_t dispatch_method) uint64_t callback_start = now; s_timer_in_callback = it; #endif + esp_timer_cb_t callback = it->callback; + void* arg = it->arg; timer_list_unlock(); - (*it->callback)(it->arg); + (*callback)(arg); timer_list_lock(); now = esp_timer_impl_get_time(); #if WITH_PROFILING