mirror of
https://github.com/espressif/esp-idf.git
synced 2025-07-30 18:57:19 +02:00
Merge branch 'bugfix/wifi_netif_on_off_cycle_race_v4.3' into 'release/v4.3'
wifi: Fix race conditon invoking invalid callback on deinit (v4.3) See merge request espressif/esp-idf!16622
This commit is contained in:
@ -109,6 +109,11 @@ esp_err_t esp_wifi_deinit(void)
|
|||||||
return ESP_ERR_WIFI_NOT_STOPPED;
|
return ESP_ERR_WIFI_NOT_STOPPED;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (esp_wifi_internal_reg_rxcb(WIFI_IF_STA, NULL) != ESP_OK ||
|
||||||
|
esp_wifi_internal_reg_rxcb(WIFI_IF_AP, NULL) != ESP_OK) {
|
||||||
|
ESP_LOGW(TAG, "Failed to unregister Rx callbacks");
|
||||||
|
}
|
||||||
|
|
||||||
esp_supplicant_deinit();
|
esp_supplicant_deinit();
|
||||||
err = esp_wifi_deinit_internal();
|
err = esp_wifi_deinit_internal();
|
||||||
if (err != ESP_OK) {
|
if (err != ESP_OK) {
|
||||||
|
@ -89,6 +89,11 @@ static esp_err_t wifi_driver_start(esp_netif_t * esp_netif, void * args)
|
|||||||
|
|
||||||
void esp_wifi_destroy_if_driver(wifi_netif_driver_t h)
|
void esp_wifi_destroy_if_driver(wifi_netif_driver_t h)
|
||||||
{
|
{
|
||||||
|
if (h) {
|
||||||
|
esp_wifi_internal_reg_rxcb(h->wifi_if, NULL); // ignore the potential error
|
||||||
|
// as the wifi might have been already uninitialized
|
||||||
|
s_wifi_netifs[h->wifi_if] = NULL;
|
||||||
|
}
|
||||||
free(h);
|
free(h);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user