mirror of
https://github.com/gfx-rs/wgpu.git
synced 2026-01-10 10:47:57 -05:00
[webgpu] fix device loss callback to be immediately drop (#7992)
This commit is contained in:
@@ -2391,6 +2391,9 @@ impl dispatch::DeviceInterface for WebDevice {
|
||||
);
|
||||
});
|
||||
let _ = self.inner.lost().then(&closure);
|
||||
// Release memory management of this closure from Rust to the JS GC.
|
||||
// TODO: This will leak if weak references is not supported.
|
||||
closure.forget();
|
||||
}
|
||||
|
||||
fn on_uncaptured_error(&self, handler: Box<dyn crate::UncapturedErrorHandler>) {
|
||||
@@ -2400,7 +2403,8 @@ impl dispatch::DeviceInterface for WebDevice {
|
||||
}) as Box<dyn FnMut(_)>);
|
||||
self.inner
|
||||
.set_onuncapturederror(Some(f.as_ref().unchecked_ref()));
|
||||
// TODO: This will leak the memory associated with the error handler by default.
|
||||
// Release memory management of this closure from Rust to the JS GC.
|
||||
// TODO: This will leak if weak references is not supported.
|
||||
f.forget();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user