-
Notifications
You must be signed in to change notification settings - Fork 11
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
Fixes to compile against the new libnetapi.so, radio search functionality restored, crashes fixed #39
Conversation
…lity restored, check if iconUrl is empty before trying to download the icon (fixes crash)
…g Haiku coding style the if-else logic got messed up and StreamRadio was crashing when trying to load certain Station logos (will provide examples if needed)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have no idea if your solution is correct, but with it the app doesn't crash anymore.
request.SetTimeout(10000); | ||
request.SetDiscardData(true); | ||
request.SetUserAgent("StreamRadio/0.0.4"); | ||
BHttpRequest* request = dynamic_cast<BHttpRequest*>(BUrlProtocolRoster::MakeRequest(url.UrlString().String(), NULL)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you are missing a delete request; at the end of the function, otherwise this will leak memory.
@@ -194,31 +194,31 @@ HttpUtils::GetAll(BUrl url, BHttpHeaders* responseHeaders, bigtime_t timeOut, | |||
return data; | |||
|
|||
HttpIOReader reader(data, responseHeaders, sizeLimit); | |||
HttpRequest request(url, false, "HTTP", &reader); | |||
BHttpRequest* request = dynamic_cast<BHttpRequest*>(BUrlProtocolRoster::MakeRequest(url.UrlString().String(), &reader, NULL)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you are missing a "delete request;" at the end of the function to avoid a memory leak.
The network API has changed a couple of weeks ago. As a result, StreamRadio wasn't compiling anymore, at least on hrev54958, These changes allow StreamRadio to compile again, and, as a bonus, restore the radio search functionality that we missed at some point (using the package from Haiku Depot on hrev54598, at least).
While testing the app, I've discovered that it had a crash every time it tried to download a non-existent icon. The minor fix just checks if the BString that holds the icon URL is empty before proceeding with the download.
I've just realized that there's another PR waiting to be merged, but it seems that we didn't duplicate efforts and that one addresses different problems.