mirror of
https://github.com/hrydgard/ppsspp.git
synced 2026-11-29 17:23:40 +01:00
Clearing fixes, fix out-of-bounds iterator
This commit is contained in:
1 parent
5418be738b
commit
2243ec5b31
1 file changed
+17
-1
+17
-1
@@ -228,7 +228,11 @@ namespace SaveState
|
||||
int blockSize = std::min(BLOCK_SIZE, (int)(compressed.size() - i));
|
||||
result.insert(result.end(), compressed.begin() + i, compressed.begin() + i + blockSize);
|
||||
i += blockSize;
|
||||
basePos += blockSize;
|
||||
// This check is to avoid advancing basePos out of range, which MSVC catches.
|
||||
// When this happens, we're at the end of decoding anyway.
|
||||
if (base.end() - basePos >= blockSize) {
|
||||
basePos += blockSize;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -242,6 +246,18 @@ namespace SaveState
|
||||
std::lock_guard<std::mutex> guard(lock_);
|
||||
first_ = 0;
|
||||
next_ = 0;
|
||||
for (auto &b : bases_) {
|
||||
b.clear();
|
||||
}
|
||||
baseMapping_.clear();
|
||||
baseMapping_.resize(size_);
|
||||
for (auto &s : states_) {
|
||||
s.clear();
|
||||
}
|
||||
buffer_.clear();
|
||||
base_ = -1;
|
||||
baseUsage_ = 0;
|
||||
rewindLastTime = time_now_d();
|
||||
}
|
||||
|
||||
bool Empty() const
|
||||
|
||||
Reference in new issue
Block a user