mirror of
https://github.com/tzapu/WiFiManager.git
synced 2026-04-27 17:15:53 +03:00
[GH-ISSUE #1046] Event handler not de-registered when WiFiManager destroyed #894
Labels
No labels
📶 WiFi
🕸️ HTTP
Branch
DEV Help Wanted
Discussion
Documentation
ESP32
Example
Good First Issue
Hotfix
In Progress
Incomplete
Needs Feeback
Priority
QA
Question
Task
Upstream/Dependancy
bug
duplicate
enhancement
invalid
pull-request
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/WiFiManager#894
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @liebman on GitHub (May 4, 2020).
Original GitHub issue: https://github.com/tzapu/WiFiManager/issues/1046
ESP32 on the development branch. The WiFiManager object was destroyed much earlier. The event callback gets called and eventually crash.
github.com/tzapu/WiFiManager@293f705b0f/WiFiManager.cpp (L208-L211)@tablatronix commented on GitHub (May 4, 2020):
haha
@tablatronix commented on GitHub (May 11, 2020):
Do you know which event, I am having a hard time reproducing to make sure a fix is working.
What does your code look like ?
@liebman commented on GitHub (May 11, 2020):
Hmm - don't know, but my guess would be something that happens at DHCP renew maybe? It was hours after the WiFiManager was destroyed. My code is changed to work around it by not creating a WiFiManager unless I need to config. Than reset after the config. If I get some time next weekend I'll try to reproduce it again and find the event. In any case I also saw that the core has no way of removing event handlers passed in as std::functions :-(
@tablatronix commented on GitHub (May 11, 2020):
were you up to date because there is a flag in the event handler to avoid this..
odd
@tablatronix commented on GitHub (May 11, 2020):
Well I added an event id, not sure if I need to protect its memory or not.. let me know if it fixes your problem.
@liebman commented on GitHub (May 11, 2020):
If your talking about
_hasBegunthat won't help once the WiFiManger object has been destroyed (and memory returned to heap or stack)...... It would see some random value. That would only work if its static.....@liebman commented on GitHub (May 11, 2020):
I'll give your update a try this weekend.
@tablatronix commented on GitHub (May 11, 2020):
oh your right its not static, hmm I think I just reused it, it was for something else originally oops.
well this should take care of it, I think