-
Notifications
You must be signed in to change notification settings - Fork 13.3k
Exception thrown with example StreamHTTPClient.ino #6028
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
Comments
Can you please try with the GIT head version? I believe the fix for the issue you mentioned was put in after 2.5.0 came out. |
I opened the issue with HEAD of master With v2.5.0, the stack trace is a little bit different:
|
@mockersf HTTPClient http;
WiFiClient client; What happens if those two lines are inverted? |
It works, thanks to the C++ guarantee of destructor ordering in reverse declaration order. At least, I hope that's guaranteed. I can repro it myself w/head but only w/no debugging at all. Enabling debug of any kind seems to protect that double-freed memory. Solution is to update the example showing proper declaration order, or move the client construction out of the if{} completely so it's guaranteed a longer life than the httpclient. |
Fix WiFiClient vs. HttpClient declaration order Fixes #6028
Inverting the two lines works in both the example and my own sketch ! I think it would be better to invert them in the example, as in my case having them out of the |
Thanks @devyte ! |
Fix WiFiClient vs. HttpClient declaration order Fixes #6028
Basic Infos
Platform
Settings in IDE
Problem Description
When using an http client with a WiFiClient to read the response as a stream, an exception is thrown when deleting the client
MCVE Sketch
Sketch is the one from here : https://github.com/esp8266/Arduino/blob/master/libraries/ESP8266HTTPClient/examples/StreamHttpClient/StreamHttpClient.ino
Debug Messages
Issue sound similar to #5216
The text was updated successfully, but these errors were encountered: