DataBlockCache: Fix crash in cache invalidation (#142)
The original version uses a reverse iterator, whose .base() is invalid after KillMacroBlock() erases it.
This commit is contained in:
parent
cb0af6ca35
commit
67d9fd9aa4
1 changed files with 5 additions and 2 deletions
|
@ -150,8 +150,11 @@ public:
|
|||
}
|
||||
|
||||
// Remove old entries until we're under the max size
|
||||
for (auto it = age.rbegin(); size > max_size && it != age.rend(); )
|
||||
KillMacroBlock(**it++);
|
||||
while (size > max_size) {
|
||||
// When size > 0, age should never be empty
|
||||
assert(!age.empty());
|
||||
KillMacroBlock(**age.rbegin());
|
||||
}
|
||||
}
|
||||
|
||||
/// @brief Obtain a data block from the cache
|
||||
|
|
Loading…
Reference in a new issue