From 096afea6f13692fddbfad0b07e5377cb2e81dd58 Mon Sep 17 00:00:00 2001 From: Mica White Date: Thu, 26 Dec 2024 11:06:23 -0500 Subject: Rename kill to poison --- src/collection/boxed.rs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'src/collection/boxed.rs') diff --git a/src/collection/boxed.rs b/src/collection/boxed.rs index 2397bd3..a048d2b 100644 --- a/src/collection/boxed.rs +++ b/src/collection/boxed.rs @@ -21,9 +21,9 @@ fn contains_duplicates(l: &[&dyn RawLock]) -> bool { } unsafe impl RawLock for BoxedLockCollection { - fn kill(&self) { + fn poison(&self) { for lock in &self.locks { - lock.kill(); + lock.poison(); } } @@ -196,6 +196,8 @@ impl BoxedLockCollection { self.locks.clear(); // safety: this was allocated using a box, and is now unique let boxed: Box> = Box::from_raw(self.data.cast_mut()); + // to prevent a double free + std::mem::forget(self); boxed.into_inner() } -- cgit v1.2.3