mirror of
https://github.com/TES3MP/openmw-tes3mp.git
synced 2025-01-19 22:23:51 +00:00
[Client] Ensure mwmp::Main is initialized before GUIController cleanup
Previously, certain errors early in the program's execution – such as an attempt to use two different packet processors for the same packet ID – would not be displayed because of a crash when attempting to get an uninitialized mwmp::Main in the Engine's destructor.
This commit is contained in:
parent
5b4db83d61
commit
270867a397
3 changed files with 10 additions and 2 deletions
|
@ -345,8 +345,10 @@ OMW::Engine::~Engine()
|
||||||
/*
|
/*
|
||||||
Start of tes3mp addition
|
Start of tes3mp addition
|
||||||
|
|
||||||
Free up memory allocated by multiplayer's GUIController
|
Free up memory allocated by multiplayer's GUIController, but make sure
|
||||||
|
mwmp::Main has actually been initialized
|
||||||
*/
|
*/
|
||||||
|
if (mwmp::Main::isInitialized())
|
||||||
mwmp::Main::get().getGUIController()->cleanUp();
|
mwmp::Main::get().getGUIController()->cleanUp();
|
||||||
/*
|
/*
|
||||||
End of tes3mp addition
|
End of tes3mp addition
|
||||||
|
|
|
@ -163,6 +163,11 @@ void Main::postInit()
|
||||||
MWBase::Environment::get().getMechanicsManager()->toggleAI();
|
MWBase::Environment::get().getMechanicsManager()->toggleAI();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool Main::isInitialized()
|
||||||
|
{
|
||||||
|
return pMain != nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
void Main::destroy()
|
void Main::destroy()
|
||||||
{
|
{
|
||||||
assert(pMain);
|
assert(pMain);
|
||||||
|
|
|
@ -23,6 +23,7 @@ namespace mwmp
|
||||||
static void configure(const boost::program_options::variables_map &variables);
|
static void configure(const boost::program_options::variables_map &variables);
|
||||||
static bool init(std::vector<std::string> &content, Files::Collections &collections);
|
static bool init(std::vector<std::string> &content, Files::Collections &collections);
|
||||||
static void postInit();
|
static void postInit();
|
||||||
|
static bool isInitialized();
|
||||||
static void destroy();
|
static void destroy();
|
||||||
static const Main &get();
|
static const Main &get();
|
||||||
static void frame(float dt);
|
static void frame(float dt);
|
||||||
|
|
Loading…
Reference in a new issue