Fix race on resize in terminal ui

This commit is contained in:
Maxime Coste 2020-07-03 21:04:08 +10:00
parent 86025f88c4
commit b3025b87d0

View File

@ -162,6 +162,9 @@ void TerminalUI::Window::draw(DisplayCoord pos,
ConstArrayView<DisplayAtom> atoms, ConstArrayView<DisplayAtom> atoms,
const Face& default_face) const Face& default_face)
{ {
if (pos.line >= lines.size()) // We might receive an out of date draw command after a resize
return;
lines[(size_t)pos.line].resize(pos.column); lines[(size_t)pos.line].resize(pos.column);
for (const DisplayAtom& atom : atoms) for (const DisplayAtom& atom : atoms)
{ {