mirror of
https://github.com/araxiaonline/TrinityCore.git
synced 2026-06-13 03:32:28 -04:00
Fix seg fault on exit
This commit is contained in:
@@ -7,6 +7,8 @@
|
||||
#include "ElunaMgr.h"
|
||||
#include "LuaEngine.h"
|
||||
|
||||
bool ElunaMgr::_shuttingDown = false;
|
||||
|
||||
ElunaMgr::ElunaMgr()
|
||||
{
|
||||
}
|
||||
@@ -19,6 +21,7 @@ ElunaMgr* ElunaMgr::instance()
|
||||
|
||||
ElunaMgr::~ElunaMgr()
|
||||
{
|
||||
_shuttingDown = true;
|
||||
}
|
||||
|
||||
void ElunaMgr::Create(Map* map, ElunaInfo const& info)
|
||||
@@ -57,7 +60,7 @@ void ElunaMgr::Destroy(ElunaInfo const& info)
|
||||
|
||||
ElunaInfo::~ElunaInfo()
|
||||
{
|
||||
if (IsValid() && sElunaMgr)
|
||||
if (IsValid() && !ElunaMgr::IsShuttingDown())
|
||||
sElunaMgr->Destroy(key);
|
||||
}
|
||||
|
||||
|
||||
@@ -92,6 +92,7 @@ private:
|
||||
|
||||
public:
|
||||
static ElunaMgr* instance();
|
||||
static bool IsShuttingDown() { return _shuttingDown; }
|
||||
|
||||
void Create(Map* map, ElunaInfo const& info);
|
||||
|
||||
@@ -103,6 +104,7 @@ public:
|
||||
|
||||
private:
|
||||
std::unordered_map<ElunaInfoKey, std::unique_ptr<Eluna>> _elunaMap;
|
||||
static bool _shuttingDown;
|
||||
};
|
||||
|
||||
#define sElunaMgr ElunaMgr::instance()
|
||||
|
||||
Reference in New Issue
Block a user