Skip to content

Fix(NetworkEvents): Don't skip event callbacks in NetworkEvents::removeEvent #10319

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 2 commits into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions libraries/Network/src/NetworkEvents.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -221,6 +221,7 @@ void NetworkEvents::removeEvent(NetworkEventCb cbEvent, arduino_event_id_t event
NetworkEventCbList_t entry = cbEventList[i];
if (entry.cb == cbEvent && entry.event == event) {
cbEventList.erase(cbEventList.begin() + i);
i--; // Don't skip over any entries in the list
}
}
}
Expand All @@ -240,6 +241,7 @@ void NetworkEvents::removeEvent(NetworkEventFuncCb cbEvent, arduino_event_id_t e
NetworkEventCbList_t entry = cbEventList[i];
if (getStdFunctionAddress(entry.fcb) == getStdFunctionAddress(cbEvent) && entry.event == event) {
cbEventList.erase(cbEventList.begin() + i);
i--; // Don't skip over any entries in the list
}
}
}
Expand All @@ -253,6 +255,7 @@ void NetworkEvents::removeEvent(NetworkEventSysCb cbEvent, arduino_event_id_t ev
NetworkEventCbList_t entry = cbEventList[i];
if (entry.scb == cbEvent && entry.event == event) {
cbEventList.erase(cbEventList.begin() + i);
i--; // Don't skip over any entries in the list
}
}
}
Expand All @@ -262,6 +265,7 @@ void NetworkEvents::removeEvent(network_event_handle_t id) {
NetworkEventCbList_t entry = cbEventList[i];
if (entry.id == id) {
cbEventList.erase(cbEventList.begin() + i);
i--; // Don't skip over any entries in the list
}
}
}
Expand Down