1
0
Fork 1
mirror of https://github.com/TES3MP/openmw-tes3mp.git synced 2025-04-01 15:36:42 +00:00

Fix use of freed memory

This commit is contained in:
Koncord 2016-10-01 10:54:42 +08:00
parent f276edddcc
commit fa0a55c2a9
5 changed files with 15 additions and 7 deletions

View file

@ -28,6 +28,7 @@
#include <components/translation/translation.hpp>
#include <components/version/version.hpp>
#include <components/openmw-mp/Log.hpp>
#include "mwinput/inputmanagerimp.hpp"
@ -230,8 +231,11 @@ OMW::Engine::Engine(Files::ConfigurationManager& configurationManager)
OMW::Engine::~Engine()
{
mwmp::Main::get().getGUIController()->cleanup();
mEnvironment.cleanup();
mwmp::Main::Destroy();
delete mScriptContext;
mScriptContext = NULL;
@ -246,6 +250,9 @@ OMW::Engine::~Engine()
}
SDL_Quit();
LOG_QUIT();
}
void OMW::Engine::enableFSStrict(bool fsStrict)
@ -719,7 +726,6 @@ void OMW::Engine::go()
// Save user settings
settings.saveUser(settingspath);
mwmp::Main::Destroy();
std::cout << "Quitting peacefully." << std::endl;
}

View file

@ -387,7 +387,6 @@ int main(int argc, char**argv)
std::cout.rdbuf(cout_rdbuf);
std::cerr.rdbuf(cerr_rdbuf);
LOG_QUIT();
return ret;
}

View file

@ -24,9 +24,14 @@ mwmp::GUIController::GUIController(): mInputBox(0)
mwmp::GUIController::~GUIController()
{
/* if (mChat != nullptr)
}
void mwmp::GUIController::cleanup()
{
if (mChat != nullptr)
delete mChat;
mChat = nullptr;*/
mChat = nullptr;
}
void mwmp::GUIController::setupChat(const Settings::Manager &mgr)

View file

@ -18,6 +18,7 @@ namespace mwmp
public:
GUIController();
~GUIController();
void cleanup();
void setupChat(const Settings::Manager &manager);
void PrintChatMessage(std::string &msg);

View file

@ -75,7 +75,6 @@ Main::~Main()
LOG_MESSAGE_SIMPLE(Log::LOG_INFO, "%s", "TES3MP stopped");
delete mNetworking;
delete mLocalPlayer;
delete mGUIController;
Players::CleanUp();
}
@ -157,8 +156,6 @@ void Main::Destroy()
{
assert(pMain);
delete pMain->mGUIController;
delete pMain;
pMain = 0;
}