libsdl-org / SDL_mixer

An audio mixer that supports various file formats for Simple Directmedia Layer.
zlib License
432 stars 147 forks source link

Prevent a double call of the Mix_ChannelFinished() callback when using Mix_FadeOutChannel() #539

Closed oleg-derevenetz closed 1 year ago

oleg-derevenetz commented 1 year ago

Currently, in the main branch, in a situation when Mix_FadeOutChannel() is called before the end of the playback, but when there is less than ms milliseconds left before the end of the track, there will be two calls of Mix_ChannelFinished() callback instead of one - the first is when playback is finished, and the second is when the fade timer expires. This may lead to various issues (e.g. to the double-free issue when Mix_ChannelFinished() callback is used to release the Mix_Chunk).

slouken commented 1 year ago

Merged, thanks!

oleg-derevenetz commented 1 year ago

Hi @slouken it would be nice if this commit would be eventually added to the SDL2 branch as well.

slouken commented 1 year ago

Merged!