Fix possible exit crash

This commit is contained in:
Benau 2022-04-30 11:55:47 +08:00
parent ae2cfb4162
commit ed14ab5091

View File

@ -2689,6 +2689,21 @@ static void cleanSuperTuxKart()
irr_driver->updateConfigIfRelevant();
AchievementsManager::destroy();
Referee::cleanup();
if (SFXManager::get() &&
!SFXManager::get()->waitForReadyToDeleted(2.0f))
{
Log::info("Thread", "SFXManager not stopping, exiting anyway.");
}
SFXManager::destroy();
// Music manager can not be deleted before the SFX thread is stopped
// (since SFX commands can contain music information, which are
// deleted by the music manager).
delete music_manager;
// Race manager needs to be deleted after sfx manager as it checks for
// the kart size structure from race manager
RaceManager::destroy();
if(grand_prix_manager) delete grand_prix_manager;
if(highscore_manager) delete highscore_manager;
@ -2746,18 +2761,6 @@ static void cleanSuperTuxKart()
}
}
if (SFXManager::get() &&
!SFXManager::get()->waitForReadyToDeleted(2.0f))
{
Log::info("Thread", "SFXManager not stopping, exiting anyway.");
}
SFXManager::destroy();
// Music manager can not be deleted before the SFX thread is stopped
// (since SFX commands can contain music information, which are
// deleted by the music manager).
delete music_manager;
// The add-ons manager might still be called from a currenty running request
// in the request manager, so it can not be deleted earlier.
#ifndef SERVER_ONLY