We are currently migrating Bugzilla to GitHub issues.
Any changes made to the bug tracker now will be lost, so please do not post new bugs or make changes to them.
When we're done, all bug URLs will redirect to their equivalent location on the new bug tracker.

Bug 1168 - Mix_FreeMusic doesn't close the file handle when playing WAVE audio
Summary: Mix_FreeMusic doesn't close the file handle when playing WAVE audio
Status: RESOLVED FIXED
Alias: None
Product: SDL_mixer
Classification: Unclassified
Component: misc (show other bugs)
Version: 1.2.11
Hardware: All Other
: P2 normal
Assignee: Ryan C. Gordon
QA Contact: Sam Lantinga
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-03-11 11:37 UTC by jjs
Modified: 2011-12-31 15:34 UTC (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description jjs 2011-03-11 11:37:57 UTC
When using SDL_Mixer to play WAVE music, the call to Mix_FreeMusic does not close the associated file handle.

There is a check in WAVStream_FreeSong() of wavestream.c like this:

if ( wave->freerw ) {
  SDL_FreeRW(wave->rw);
}

But the variable freerw is not referenced anywhere else. SDL_FreeRW would also not close the file from what I can tell.

Something like this should do the trick:

if ( wave->rw ) {
  SDL_RWclose(wave->rw);
}
Comment 1 Sam Lantinga 2011-12-31 15:34:25 UTC
Fixed, thanks!
http://hg.libsdl.org/SDL_mixer/rev/565549e046b0