[Client] Fix actor memory leaks, part 1

This commit is contained in:
David Cernat 2017-04-30 04:19:28 +03:00
parent 0ba8a407bc
commit f6a218025a
2 changed files with 5 additions and 0 deletions

View file

@ -326,6 +326,8 @@ void Cell::uninitializeLocalActors()
for (std::map<std::string, LocalActor *>::iterator it = localActors.begin(); it != localActors.end(); ++it)
{
Main::get().getCellController()->removeLocalActorRecord(it->first);
delete it->second->creatureStats;
delete it->second;
}
localActors.clear();
@ -336,6 +338,8 @@ void Cell::uninitializeDedicatedActors()
for (std::map<std::string, DedicatedActor *>::iterator it = dedicatedActors.begin(); it != dedicatedActors.end(); ++it)
{
Main::get().getCellController()->removeDedicatedActorRecord(it->first);
delete it->second->creatureStats;
delete it->second;
}
dedicatedActors.clear();

View file

@ -38,6 +38,7 @@ void CellController::updateLocal(bool forceUpdate)
{
mpCell->uninitializeLocalActors();
mpCell->uninitializeDedicatedActors();
delete it->second;
cellsInitialized.erase(it++);
}
else