HaikuArchives / StreamRadio

Haiku-native application to search for and listen to internet radio stations.
8 stars 11 forks source link

Crash after closing application #6

Closed Vidrep closed 5 years ago

Vidrep commented 5 years ago

Launch StreamRadio, play station, stop

Close StreamRadio...crash

Link to debugger report: https://www.heypasteit.com/clip/0ISKAG

jsteinaker commented 5 years ago

Commenting all the fVolume lines in StationPanel.cpp (that is, disabling the volume control entirely) the app doesn't crash anymore.

I'm by no means a developer, I just have some basic understanding, but the crash seems to happen when the app tries to free the memory used by the volume slider, and it calls BInvoker's SetMessage method.

Any ideas?

jsteinaker commented 5 years ago

UPDATE: commenting line 53 on StationPanel.cpp solves the problem, and the volume slider is back and working. I guess that line is supposed to set the tooltip to use when the slider is grabbed with the mouse, I'll check that later.

Numerio commented 5 years ago

BSlider::SetModificationMessage takes ownership of the BMessage (that means will be deleted when the BSlider is deleted), BSlider::Message() returns the message passed in the BSlider constructor which also take ownership, what happens is that the message is going to be deleted two times, one time by BSlider and one time by it's father class BControl, causing a double free crash.

So to fix the issue just make a copy of the message like fVolume->SetModificationMessage(new BMessage(*theothermessage)); or something along those lines.

Aaah, good old BeAPI...

jsteinaker commented 5 years ago

Thanks for pointing this out. Quick and simple. I've already made the change in my repo.

waddlesplash commented 5 years ago

Feel free to submit a PR :)

Numerio commented 5 years ago

Forking may be also an option if you want to maintain an abandoned program.

jsteinaker commented 5 years ago

I've just sent a PR with various fixes (this crash, the DNS resolver thing, and some others). Please excuse any obvious flaws that may be there, as I'm not a serious coder by any means. With that in mind, it's definitely working better than before.