Closed treere closed 2 years ago
Hi!
When one of the guardian struct is the only one keeping the handler alive, during drop the stack/heap is corrupted.
pub struct Example { _handle: Arc<Mutex<i8>>, inner: MutexGuard<'static, i8>, }
If _handle is dropped before inner, when inner is dropped it tries to unlock _handler but it has already been dropped.
_handle
inner
_handler
The drop field order in Rust is not fixed so I used an Option to force the right order.
Option
Have a nice day!
Thanks for the review! I have applied the changes
Published as 1.0.2!
Hi!
When one of the guardian struct is the only one keeping the handler alive, during drop the stack/heap is corrupted.
If
_handle
is dropped beforeinner
, wheninner
is dropped it tries to unlock_handler
but it has already been dropped.The drop field order in Rust is not fixed so I used an
Option
to force the right order.Have a nice day!