fix: Properly drop UseFuture's values to avoid leaking memory
This commit is contained in:
1 parent
f63220019d
commit
1546fce485
1 file changed
+8
@@ -89,6 +89,14 @@ pub struct UseFuture<T> {
|
||||
values: Rc<RefCell<Vec<*mut T>>>,
|
||||
}
|
||||
|
||||
impl<T> Drop for UseFuture<T> {
|
||||
fn drop(&mut self) {
|
||||
for value in self.values.take().into_iter() {
|
||||
drop(unsafe { Box::from_raw(value) })
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
pub enum UseFutureState<'a, T> {
|
||||
Pending,
|
||||
Complete(&'a T),
|
||||
|
||||
Reference in new issue
Block a user