1
0
forked from 0ad/0ad

Opening a second music file now closes (rather than leaks) the first

This was SVN commit r925.
This commit is contained in:
Ykkrosh 2004-08-06 15:04:16 +00:00
parent 138df056bd
commit 778862f429

View File

@ -112,6 +112,11 @@ CMusicPlayer::~CMusicPlayer(void)
void CMusicPlayer::open(char *filename)
{
// If a new file is opened while another is already in memory,
// close the old one first.
if (is_open)
release();
int ret = 0;
format = 0;
info = NULL;
@ -125,7 +130,6 @@ void CMusicPlayer::open(char *filename)
}
else
LOG(NORMAL, "CMusicPlayer::open(): file %s loaded successfully\n", filename);
// TODO maybe: Free the mem handle returned by vfs_load (using mem_free_h) ??
memFile.dataPtr = (char*)p;
memFile.dataRead = 0;