fix invalid locations never being dropped (#1747)
This commit is contained in:
1 parent
80a8e1f512
commit
cde5ac5f58
1 file changed
+4
-2
@@ -700,14 +700,16 @@ impl Owner {
|
|||||||
/// Creates an invalid handle. This is useful for creating a handle that will be filled in later. If you use this before the value is filled in, you will get may get a panic or an out of date value.
|
/// Creates an invalid handle. This is useful for creating a handle that will be filled in later. If you use this before the value is filled in, you will get may get a panic or an out of date value.
|
||||||
pub fn invalid<T: 'static>(&self) -> GenerationalBox<T> {
|
pub fn invalid<T: 'static>(&self) -> GenerationalBox<T> {
|
||||||
let location = self.store.claim();
|
let location = self.store.claim();
|
||||||
GenerationalBox {
|
let key = GenerationalBox {
|
||||||
raw: location,
|
raw: location,
|
||||||
#[cfg(any(debug_assertions, feature = "check_generation"))]
|
#[cfg(any(debug_assertions, feature = "check_generation"))]
|
||||||
generation: location.0.generation.get(),
|
generation: location.0.generation.get(),
|
||||||
#[cfg(any(debug_assertions, feature = "debug_ownership"))]
|
#[cfg(any(debug_assertions, feature = "debug_ownership"))]
|
||||||
created_at: std::panic::Location::caller(),
|
created_at: std::panic::Location::caller(),
|
||||||
_marker: PhantomData,
|
_marker: PhantomData,
|
||||||
}
|
};
|
||||||
|
self.owned.borrow_mut().push(location);
|
||||||
|
key
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user