Fix when replacing an overlay

When an overlay handle dropped directly after pushing a new overlay, it
was possible for new overlays to be popped off improperly, causing a
subtraction overflow panic later.
This commit is contained in:
Jonathan Johnson 2024-03-21 11:26:34 -07:00
parent abbf8d94d8
commit 44759d4812
No known key found for this signature in database
GPG key ID: A66D6A34D6620579

View file

@ -721,8 +721,8 @@ impl Drop for OverlayHandle {
return;
};
while state.overlays.len() > index {
let _removed = state.overlays.pop();
while state.overlays.len() - state.new_overlays > index {
let _removed = state.overlays.remove_by_index(index);
}
}
}