Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 8 additions & 12 deletions src/source/buffered.rs
Original file line number Diff line number Diff line change
Expand Up @@ -78,18 +78,14 @@ where
// solves the problem, as when the time comes to actually deallocate the `FrameData`,
// the `next` field will contain a `Frame::End`, or an `Arc` with additional references,
// so the depth of recursive drops will be bounded.
loop {
if let Ok(arc_next) = self.next.get_mut() {
if let Some(next_ref) = Arc::get_mut(arc_next) {
// This allows us to own the next Frame.
let next = mem::replace(next_ref, Frame::End);
if let Frame::Data(next_data) = next {
// Swap the current FrameData with the next one, allowing the current one
// to go out of scope.
*self = next_data;
} else {
break;
}
while let Ok(arc_next) = self.next.get_mut() {
if let Some(next_ref) = Arc::get_mut(arc_next) {
// This allows us to own the next Frame.
let next = mem::replace(next_ref, Frame::End);
if let Frame::Data(next_data) = next {
// Swap the current FrameData with the next one, allowing the current one
// to go out of scope.
*self = next_data;
} else {
break;
}
Expand Down