mirror of
https://github.com/TES3MP/openmw-tes3mp.git
synced 2025-04-01 15:06:43 +00:00
Fix use of freed memory
This commit is contained in:
parent
f276edddcc
commit
fa0a55c2a9
5 changed files with 15 additions and 7 deletions
|
@ -28,6 +28,7 @@
|
||||||
#include <components/translation/translation.hpp>
|
#include <components/translation/translation.hpp>
|
||||||
|
|
||||||
#include <components/version/version.hpp>
|
#include <components/version/version.hpp>
|
||||||
|
#include <components/openmw-mp/Log.hpp>
|
||||||
|
|
||||||
#include "mwinput/inputmanagerimp.hpp"
|
#include "mwinput/inputmanagerimp.hpp"
|
||||||
|
|
||||||
|
@ -230,8 +231,11 @@ OMW::Engine::Engine(Files::ConfigurationManager& configurationManager)
|
||||||
|
|
||||||
OMW::Engine::~Engine()
|
OMW::Engine::~Engine()
|
||||||
{
|
{
|
||||||
|
mwmp::Main::get().getGUIController()->cleanup();
|
||||||
mEnvironment.cleanup();
|
mEnvironment.cleanup();
|
||||||
|
|
||||||
|
mwmp::Main::Destroy();
|
||||||
|
|
||||||
delete mScriptContext;
|
delete mScriptContext;
|
||||||
mScriptContext = NULL;
|
mScriptContext = NULL;
|
||||||
|
|
||||||
|
@ -246,6 +250,9 @@ OMW::Engine::~Engine()
|
||||||
}
|
}
|
||||||
|
|
||||||
SDL_Quit();
|
SDL_Quit();
|
||||||
|
|
||||||
|
|
||||||
|
LOG_QUIT();
|
||||||
}
|
}
|
||||||
|
|
||||||
void OMW::Engine::enableFSStrict(bool fsStrict)
|
void OMW::Engine::enableFSStrict(bool fsStrict)
|
||||||
|
@ -719,7 +726,6 @@ void OMW::Engine::go()
|
||||||
// Save user settings
|
// Save user settings
|
||||||
settings.saveUser(settingspath);
|
settings.saveUser(settingspath);
|
||||||
|
|
||||||
mwmp::Main::Destroy();
|
|
||||||
std::cout << "Quitting peacefully." << std::endl;
|
std::cout << "Quitting peacefully." << std::endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -387,7 +387,6 @@ int main(int argc, char**argv)
|
||||||
std::cout.rdbuf(cout_rdbuf);
|
std::cout.rdbuf(cout_rdbuf);
|
||||||
std::cerr.rdbuf(cerr_rdbuf);
|
std::cerr.rdbuf(cerr_rdbuf);
|
||||||
|
|
||||||
LOG_QUIT();
|
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
|
@ -24,9 +24,14 @@ mwmp::GUIController::GUIController(): mInputBox(0)
|
||||||
|
|
||||||
mwmp::GUIController::~GUIController()
|
mwmp::GUIController::~GUIController()
|
||||||
{
|
{
|
||||||
/* if (mChat != nullptr)
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void mwmp::GUIController::cleanup()
|
||||||
|
{
|
||||||
|
if (mChat != nullptr)
|
||||||
delete mChat;
|
delete mChat;
|
||||||
mChat = nullptr;*/
|
mChat = nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
void mwmp::GUIController::setupChat(const Settings::Manager &mgr)
|
void mwmp::GUIController::setupChat(const Settings::Manager &mgr)
|
||||||
|
|
|
@ -18,6 +18,7 @@ namespace mwmp
|
||||||
public:
|
public:
|
||||||
GUIController();
|
GUIController();
|
||||||
~GUIController();
|
~GUIController();
|
||||||
|
void cleanup();
|
||||||
void setupChat(const Settings::Manager &manager);
|
void setupChat(const Settings::Manager &manager);
|
||||||
|
|
||||||
void PrintChatMessage(std::string &msg);
|
void PrintChatMessage(std::string &msg);
|
||||||
|
|
|
@ -75,7 +75,6 @@ Main::~Main()
|
||||||
LOG_MESSAGE_SIMPLE(Log::LOG_INFO, "%s", "TES3MP stopped");
|
LOG_MESSAGE_SIMPLE(Log::LOG_INFO, "%s", "TES3MP stopped");
|
||||||
delete mNetworking;
|
delete mNetworking;
|
||||||
delete mLocalPlayer;
|
delete mLocalPlayer;
|
||||||
delete mGUIController;
|
|
||||||
Players::CleanUp();
|
Players::CleanUp();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -157,8 +156,6 @@ void Main::Destroy()
|
||||||
{
|
{
|
||||||
assert(pMain);
|
assert(pMain);
|
||||||
|
|
||||||
delete pMain->mGUIController;
|
|
||||||
|
|
||||||
delete pMain;
|
delete pMain;
|
||||||
pMain = 0;
|
pMain = 0;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue