-
Notifications
You must be signed in to change notification settings - Fork 7.6k
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
Fix(NetworkEvents): Don't skip event callbacks in NetworkEvents::removeEvent #10319
Conversation
👋 Hello LeeLeahy2, we appreciate your contribution to this project! Click to see more instructions ...
Review and merge process you can expect ...
|
Hi @LeeLeahy2 ! I do disagree with the solution a bit. IMHO the fix in this case should be in |
instead of |
Hello @LeeLeahy2, thanks for the proposal. Please sign CLA too, it is needed to unblock this PR. One of the requirements, we will see how the discussion will be shaped. |
Actually return and then also add log error at the end that callback was not found |
Why even use this Also I wonder why it is kept as a |
I made the choice based upon the original implementation which continued scanning the list instead of having the break after the entry was found. As such, it looked like multiple entries were to be allowed, so I provided an example sketch to support this behavior. This also was the minimal change and did change the implementations behavior. The alternative was a much larger change and was also possibly a change in desired behavior, although this is the behavior that I would have expected:
I will submit another patch that implements the alternative behavior above. |
Thanks @LeeLeahy2 looking forward the new patch |
@LeeLeahy2 we can close this one now, correct? |
Description of Change
Modified the four (4) NetworkEvents::removeEvent routines in libraries/Network/src/NetworkEvents.cpp to decrement "i" after the event callback is erased.
Tests scenarios
Requires Fix [10317] to prevent crashes.
Used the submitted sketch for issue 10318. Without this change each actual event generates 4 callbacks initially and 2 callbacks after calling removeEvent. With this change all event handlers are removed and no further callbacks are called.
Related links
Closes issue 10318