mirror of
https://github.com/azerothcore/mod-ale
synced 2025-11-29 15:38:17 +08:00
Fix shutdown crash
This commit is contained in:
@@ -108,7 +108,8 @@ void ElunaEventProcessor::AddEvent(int funcRef, uint32 delay, uint32 repeats)
|
||||
|
||||
void ElunaEventProcessor::RemoveEvent(LuaEvent* luaEvent)
|
||||
{
|
||||
if (luaEvent->state != LUAEVENT_STATE_ERASE && Eluna::IsInitialized())
|
||||
// Unreference if should and if Eluna was not yet uninitialized and if the lua state still exists
|
||||
if (luaEvent->state != LUAEVENT_STATE_ERASE && Eluna::IsInitialized() && (*E)->HasLuaState())
|
||||
{
|
||||
// Free lua function ref
|
||||
luaL_unref((*E)->L, LUA_REGISTRYINDEX, luaEvent->funcRef);
|
||||
|
||||
@@ -269,8 +269,9 @@ public:
|
||||
}
|
||||
|
||||
void RunScripts();
|
||||
bool GetReload() const { return reload; }
|
||||
bool ShouldReload() const { return reload; }
|
||||
bool IsEnabled() const { return enabled && IsInitialized(); }
|
||||
bool HasLuaState() const { return L; }
|
||||
void Register(uint8 reg, uint32 id, uint64 guid, uint32 instanceId, uint32 evt, int func, uint32 shots);
|
||||
|
||||
// Non-static pushes, to be used in hooks.
|
||||
|
||||
@@ -376,7 +376,7 @@ void Eluna::OnWorldUpdate(uint32 diff)
|
||||
{
|
||||
{
|
||||
LOCK_ELUNA;
|
||||
if (reload)
|
||||
if (ShouldReload())
|
||||
_ReloadEluna();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user