Fix use of freed memory

coverity_scan^2
Koncord 8 years ago
parent f276edddcc
commit fa0a55c2a9

@ -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;
}

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

@ -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)

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

@ -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;
}

Loading…
Cancel
Save