mirror of
https://github.com/minetest/minetest.git
synced 2024-11-30 11:33:44 +01:00
Fix some Game members not being freed after some startup errors (#14561)
This commit is contained in:
parent
4ab3c54f5b
commit
eb432d3da0
@ -172,8 +172,9 @@ bool ClientLauncher::run(GameStartData &start_data, const Settings &cmd_args)
|
||||
m_rendering_engine->get_raw_device()->
|
||||
setWindowCaption(utf8_to_wide(caption).c_str());
|
||||
|
||||
try { // This is used for catching disconnects
|
||||
|
||||
#ifdef NDEBUG
|
||||
try {
|
||||
#endif
|
||||
m_rendering_engine->get_gui_env()->clear();
|
||||
|
||||
/*
|
||||
@ -214,18 +215,8 @@ bool ClientLauncher::run(GameStartData &start_data, const Settings &cmd_args)
|
||||
chat_backend,
|
||||
&reconnect_requested
|
||||
);
|
||||
} //try
|
||||
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;
|
||||
}
|
||||
|
||||
#ifdef NDEBUG
|
||||
catch (std::exception &e) {
|
||||
} catch (std::exception &e) {
|
||||
error_message = "Some exception: ";
|
||||
error_message.append(debug_describe_exc(e));
|
||||
errorstream << error_message << std::endl;
|
||||
|
@ -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();
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user