mirror of
https://github.com/odrling/Aegisub
synced 2025-04-11 22:56:02 +02:00
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
@ -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…
x
Reference in New Issue
Block a user