Skip to content

Commit

Permalink
Fix a panic on Linux when using samply record --iteration-count 2 ls.
Browse files Browse the repository at this point in the history
  • Loading branch information
mstange committed Mar 5, 2024
1 parent 609df07 commit d6f9edf
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions samply/src/linux/perf_group.rs
Original file line number Diff line number Diff line change
Expand Up @@ -239,10 +239,8 @@ impl PerfGroup {

for ev in self.poll_events.iter() {
if ev.is_read_closed() {
self.members
.get_mut(&(ev.token().0 as RawFd))
.unwrap()
.is_closed = true;
let fd = ev.token().0 as RawFd;
self.members.get_mut(&fd).unwrap().is_closed = true;
}
}
}
Expand Down Expand Up @@ -283,6 +281,11 @@ impl PerfGroup {
}

for fd in fds_to_remove.drain(..) {
let result = self.poll.registry().deregister(&mut SourceFd(&fd));
if let Err(err) = result {
eprintln!("deregister failed: {}", err);
continue;
}
self.members.remove(&fd);
}

Expand Down

0 comments on commit d6f9edf

Please sign in to comment.