Skip to content

Commit

Permalink
modify zombie handling code so it doesn't need to alloc
Browse files Browse the repository at this point in the history
  • Loading branch information
chris-laplante committed Jun 22, 2022
1 parent af5d925 commit 9a330db
Showing 1 changed file with 2 additions and 7 deletions.
9 changes: 2 additions & 7 deletions src/multi.rs
Original file line number Diff line number Diff line change
Expand Up @@ -209,23 +209,18 @@ impl MultiState {
now: Instant,
) -> io::Result<()> {
// Reap all consecutive 'zombie' progress bars from head of the list
let mut zombies = vec![];
let mut adjust = 0;
for index in self.ordering.iter() {
let member = &self.members[*index];
while let Some(index) = self.ordering.first().cloned() {
let member = &self.members[index];
if !member.is_zombie {
break;
}

zombies.push(*index);
adjust += member
.draw_state
.as_ref()
.map(|d| d.lines.len())
.unwrap_or_default();
}

for index in zombies {
self.remove_idx(index);
}

Expand Down

0 comments on commit 9a330db

Please sign in to comment.