From cd3c1f3fe8a2ae9e6bbc7c69ba72dad8b6addee0 Mon Sep 17 00:00:00 2001 From: DarthArgus Date: Tue, 29 Nov 2016 23:13:28 +0000 Subject: [PATCH] readd the delete - this branch i'm not sure if we need or not, same goes for smart ptr branch --- engine/server/library/serverDatabase/src/shared/Persister.cpp | 4 ++++ engine/server/library/serverDatabase/src/shared/Snapshot.cpp | 3 +++ 2 files changed, 7 insertions(+) diff --git a/engine/server/library/serverDatabase/src/shared/Persister.cpp b/engine/server/library/serverDatabase/src/shared/Persister.cpp index 218e47f2..1c45f1b2 100755 --- a/engine/server/library/serverDatabase/src/shared/Persister.cpp +++ b/engine/server/library/serverDatabase/src/shared/Persister.cpp @@ -602,6 +602,8 @@ void Persister::saveCompleted(Snapshot *completedSnapshot) SnapshotListType::iterator i=std::remove(m_savingSnapshots.begin(),m_savingSnapshots.end(),completedSnapshot); if (i!=m_savingSnapshots.end()) { + delete completedSnapshot; + m_savingSnapshots.erase(i, m_savingSnapshots.end()); if (m_savingSnapshots.empty() && ConfigServerDatabase::getReportSaveTimes()) { @@ -634,6 +636,8 @@ void Persister::saveCompleted(Snapshot *completedSnapshot) { SnapshotListType::iterator j=std::remove(m_savingCharacterSnapshots.begin(),m_savingCharacterSnapshots.end(),completedSnapshot); DEBUG_FATAL(i==m_savingCharacterSnapshots.end(),("Programmer bug: SaveCompleted() called with a snapshot that wasn't in m_savingSnapshots or m_savingCharacterSnapshots.")); + delete completedSnapshot; + m_savingCharacterSnapshots.erase(j, m_savingCharacterSnapshots.end()); DEBUG_REPORT_LOG(ConfigServerDatabase::getReportSaveTimes(),("New character save completed\n")); } diff --git a/engine/server/library/serverDatabase/src/shared/Snapshot.cpp b/engine/server/library/serverDatabase/src/shared/Snapshot.cpp index 768d8f99..c0f0b490 100755 --- a/engine/server/library/serverDatabase/src/shared/Snapshot.cpp +++ b/engine/server/library/serverDatabase/src/shared/Snapshot.cpp @@ -50,6 +50,9 @@ Snapshot::~Snapshot() *j = nullptr; } + m_locatorList.clear(); + m_customStepList.clear(); + ++ms_deletionCount; LOG("Snapshot",("Deleted snapshot. %i outstanding, %i created, %i deleted", ms_creationCount-ms_deletionCount,ms_creationCount,ms_deletionCount)); }