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