mirror of
https://github.com/TES3MP/TES3MP.git
synced 2025-09-28 23:51:09 -04: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
@ -345,9 +345,11 @@ OMW::Engine::~Engine()
|
||||
/*
|
||||
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
|
||||
*/
|
||||
mwmp::Main::get().getGUIController()->cleanUp();
|
||||
if (mwmp::Main::isInitialized())
|
||||
mwmp::Main::get().getGUIController()->cleanUp();
|
||||
/*
|
||||
End of tes3mp addition
|
||||
*/
|
||||
|
@ -163,6 +163,11 @@ void Main::postInit()
|
||||
MWBase::Environment::get().getMechanicsManager()->toggleAI();
|
||||
}
|
||||
|
||||
bool Main::isInitialized()
|
||||
{
|
||||
return pMain != nullptr;
|
||||
}
|
||||
|
||||
void Main::destroy()
|
||||
{
|
||||
assert(pMain);
|
||||
|
@ -23,6 +23,7 @@ namespace mwmp
|
||||
static void configure(const boost::program_options::variables_map &variables);
|
||||
static bool init(std::vector<std::string> &content, Files::Collections &collections);
|
||||
static void postInit();
|
||||
static bool isInitialized();
|
||||
static void destroy();
|
||||
static const Main &get();
|
||||
static void frame(float dt);
|
||||
|
Loading…
x
Reference in New Issue
Block a user