mirror of
https://github.com/gfx-rs/wgpu.git
synced 2024-11-21 22:33:49 +00:00
unregister adapters like all other resources
This commit is contained in:
parent
5b2e78da45
commit
eb0eb342cf
@ -1043,16 +1043,7 @@ impl Global {
|
||||
api_log!("Adapter::drop {adapter_id:?}");
|
||||
|
||||
let hub = A::hub(self);
|
||||
let mut adapters_locked = hub.adapters.write();
|
||||
|
||||
let free = match adapters_locked.get(adapter_id) {
|
||||
Ok(adapter) => Arc::strong_count(adapter) == 1,
|
||||
Err(_) => true,
|
||||
};
|
||||
if free {
|
||||
hub.adapters
|
||||
.unregister_locked(adapter_id, &mut *adapters_locked);
|
||||
}
|
||||
hub.adapters.unregister(adapter_id);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -111,14 +111,6 @@ impl<T: StorageItem> Registry<T> {
|
||||
pub(crate) fn write<'a>(&'a self) -> RwLockWriteGuard<'a, Storage<T>> {
|
||||
self.storage.write()
|
||||
}
|
||||
pub(crate) fn unregister_locked(
|
||||
&self,
|
||||
id: Id<T::Marker>,
|
||||
storage: &mut Storage<T>,
|
||||
) -> Option<Arc<T>> {
|
||||
self.identity.free(id);
|
||||
storage.remove(id)
|
||||
}
|
||||
pub(crate) fn force_replace_with_error(&self, id: Id<T::Marker>) {
|
||||
let mut storage = self.storage.write();
|
||||
storage.remove(id);
|
||||
|
Loading…
Reference in New Issue
Block a user