On zone shutdown purge all spells pending to be deleted so we do not reference dead spell->zone ptr
This commit is contained in:
parent
480086d85d
commit
4d0ef974ae
@ -1867,7 +1867,7 @@ void LuaInterface::AddUserDataPtr(LUAUserData* data, void* data_ptr) {
|
|||||||
user_data[data] = Timer::GetCurrentTime2() + 300000; //allow a function to use this pointer for 5 minutes
|
user_data[data] = Timer::GetCurrentTime2() + 300000; //allow a function to use this pointer for 5 minutes
|
||||||
}
|
}
|
||||||
|
|
||||||
void LuaInterface::DeletePendingSpells(bool all) {
|
void LuaInterface::DeletePendingSpells(bool all, ZoneServer* zone) {
|
||||||
MSpells.lock();
|
MSpells.lock();
|
||||||
MSpellDelete.lock();
|
MSpellDelete.lock();
|
||||||
if (spells_pending_delete.size() > 0) {
|
if (spells_pending_delete.size() > 0) {
|
||||||
@ -1876,7 +1876,7 @@ void LuaInterface::DeletePendingSpells(bool all) {
|
|||||||
vector<LuaSpell*> tmp_deletes;
|
vector<LuaSpell*> tmp_deletes;
|
||||||
vector<LuaSpell*>::iterator del_itr;
|
vector<LuaSpell*>::iterator del_itr;
|
||||||
for (itr = spells_pending_delete.begin(); itr != spells_pending_delete.end(); itr++) {
|
for (itr = spells_pending_delete.begin(); itr != spells_pending_delete.end(); itr++) {
|
||||||
if (all || time >= itr->second)
|
if ((!zone && (all || time >= itr->second)) || (zone && itr->first->zone == zone))
|
||||||
tmp_deletes.push_back(itr->first);
|
tmp_deletes.push_back(itr->first);
|
||||||
}
|
}
|
||||||
LuaSpell* spell = 0;
|
LuaSpell* spell = 0;
|
||||||
|
@ -520,7 +520,7 @@ public:
|
|||||||
map<Client*, int32> GetDebugClients(){ return debug_clients; }
|
map<Client*, int32> GetDebugClients(){ return debug_clients; }
|
||||||
void AddUserDataPtr(LUAUserData* data, void* data_ptr = 0);
|
void AddUserDataPtr(LUAUserData* data, void* data_ptr = 0);
|
||||||
void DeleteUserDataPtrs(bool all);
|
void DeleteUserDataPtrs(bool all);
|
||||||
void DeletePendingSpells(bool all);
|
void DeletePendingSpells(bool all, ZoneServer* zone = nullptr);
|
||||||
void DeletePendingSpell(LuaSpell* spell);
|
void DeletePendingSpell(LuaSpell* spell);
|
||||||
Mutex* GetSpawnScriptMutex(const char* name);
|
Mutex* GetSpawnScriptMutex(const char* name);
|
||||||
Mutex* GetItemScriptMutex(const char* name);
|
Mutex* GetItemScriptMutex(const char* name);
|
||||||
|
@ -190,6 +190,7 @@ ZoneServer::ZoneServer(const char* name) {
|
|||||||
|
|
||||||
typedef map <int32, bool> ChangedSpawnMapType;
|
typedef map <int32, bool> ChangedSpawnMapType;
|
||||||
ZoneServer::~ZoneServer() {
|
ZoneServer::~ZoneServer() {
|
||||||
|
lua_interface->DeletePendingSpells(true, this);
|
||||||
zoneShuttingDown = true; //ensure other threads shut down too
|
zoneShuttingDown = true; //ensure other threads shut down too
|
||||||
//allow other threads to properly shut down
|
//allow other threads to properly shut down
|
||||||
if(is_initialized) {
|
if(is_initialized) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user