Skip to content

Commit 47bfede

Browse files
Add device_unregister_device_lost_closure (#6588)
Co-authored-by: Erich Gubler <erichdongubler@gmail.com>
1 parent 19d80fe commit 47bfede

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

wgpu-core/src/device/global.rs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2102,6 +2102,14 @@ impl Global {
21022102
}
21032103
}
21042104

2105+
pub fn device_unregister_device_lost_closure(&self, device_id: DeviceId) {
2106+
let device = self.hub.devices.get(device_id);
2107+
let closure = device.device_lost_closure.lock().take();
2108+
if let Some(closure) = closure {
2109+
closure.call(DeviceLostReason::ReplacedCallback, "".to_string());
2110+
}
2111+
}
2112+
21052113
pub fn device_destroy(&self, device_id: DeviceId) {
21062114
api_log!("Device::destroy {device_id:?}");
21072115

0 commit comments

Comments
 (0)