Skip to content

Commit

Permalink
Handle replacing
Browse files Browse the repository at this point in the history
  • Loading branch information
Manishearth committed Dec 25, 2024
1 parent 3f421fd commit d2febb4
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/thin_arc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,11 @@ impl<H, T> ThinArc<H, T> {

// Expose the transient Arc to the callback, which may clone it if it wants
// and forward the result to the user
f(&mut transient)
let ret = f(&mut transient);
// It is possible for the user to replace the Arc entirely here. If so, we need to update the ThinArc as well
// Safety: We're still in the realm of Protected types so this cast is safe
self.ptr = transient.p.cast();
ret
}

/// Creates a `ThinArc` for a HeaderSlice using the given header struct and
Expand Down

0 comments on commit d2febb4

Please sign in to comment.