fix(esp_event): clear running_task before releasing mutex on tick timeout

When esp_event_loop_run() exited via the ticks-expired break path,
loop->running_task was left pointing to the current task handle.
Any subsequent trylock in esp_event_handler_unregister_with_internal()
would see a stale non-NULL running_task and take the wrong code path.
This commit is contained in:
Konstantin Kondrashov
2026-07-07 17:26:55 +03:00
parent 9947dfdc58
commit bcfc88681d

View File

@@ -728,6 +728,7 @@ esp_err_t esp_event_loop_run(esp_event_loop_handle_t event_loop, TickType_t tick
remaining_ticks -= end - marker;
// If the ticks to run expired, return to the caller
if (remaining_ticks <= 0) {
loop->running_task = NULL;
xSemaphoreGiveRecursive(loop->mutex);
break;
} else {