mirror of
https://github.com/vcmi/vcmi.git
synced 2025-11-25 22:42:04 +02:00
Fix possible crashes on audio shutdown
This commit is contained in:
@@ -37,7 +37,8 @@ CAudioBase::~CAudioBase()
|
|||||||
--initializationCounter;
|
--initializationCounter;
|
||||||
|
|
||||||
if(initializationCounter == 0 && initializeSuccess)
|
if(initializationCounter == 0 && initializeSuccess)
|
||||||
|
{
|
||||||
Mix_CloseAudio();
|
Mix_CloseAudio();
|
||||||
|
initializeSuccess = false;
|
||||||
initializeSuccess = false;
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -232,8 +232,7 @@ MusicEntry::~MusicEntry()
|
|||||||
|
|
||||||
if(loop == 0 && Mix_FadingMusic() != MIX_NO_FADING)
|
if(loop == 0 && Mix_FadingMusic() != MIX_NO_FADING)
|
||||||
{
|
{
|
||||||
assert(0);
|
logGlobal->trace("Halting playback of music file %s", currentName.getOriginalName());
|
||||||
logGlobal->error("Attempt to delete music while fading out!");
|
|
||||||
Mix_HaltMusic();
|
Mix_HaltMusic();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -56,6 +56,7 @@ CSoundHandler::~CSoundHandler()
|
|||||||
{
|
{
|
||||||
if(isInitialized())
|
if(isInitialized())
|
||||||
{
|
{
|
||||||
|
Mix_ChannelFinished(nullptr);
|
||||||
Mix_HaltChannel(-1);
|
Mix_HaltChannel(-1);
|
||||||
|
|
||||||
for(auto & chunk : soundChunks)
|
for(auto & chunk : soundChunks)
|
||||||
|
|||||||
Reference in New Issue
Block a user