1
0
mirror of https://github.com/luanti-org/luanti.git synced 2025-10-13 00:25:19 +02:00

Fix some Game members not being freed after some startup errors (#14561)

This commit is contained in:
grorp
2024-04-21 15:52:46 +02:00
committed by GitHub
parent 4ab3c54f5b
commit eb432d3da0
2 changed files with 20 additions and 13 deletions

View File

@@ -1015,6 +1015,12 @@ Game::Game() :
Game::~Game()
{
delete client;
delete soundmaker;
sound_manager.reset();
delete server;
delete hud;
delete camera;
delete quicktune;
@@ -1267,11 +1273,14 @@ void Game::shutdown()
}
delete client;
client = nullptr;
delete soundmaker;
soundmaker = nullptr;
sound_manager.reset();
auto stop_thread = runInThread([=] {
delete server;
server = nullptr;
}, "ServerStop");
FpsControl fps_control;
@@ -4561,6 +4570,13 @@ void the_game(bool *kill,
error_message = std::string("ModError: ") + e.what() +
strgettext("\nCheck debug.txt for details.");
errorstream << error_message << std::endl;
} catch (con::PeerNotFoundException &e) {
error_message = gettext("Connection error (timed out?)");
errorstream << error_message << std::endl;
} catch (ShaderException &e) {
error_message = e.what();
errorstream << error_message << std::endl;
}
game.shutdown();
}