diff options
Diffstat (limited to 'components/script/dom/gpubuffer.rs')
-rw-r--r-- | components/script/dom/gpubuffer.rs | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/components/script/dom/gpubuffer.rs b/components/script/dom/gpubuffer.rs index efdc2e87a77..bfffb98bd73 100644 --- a/components/script/dom/gpubuffer.rs +++ b/components/script/dom/gpubuffer.rs @@ -130,8 +130,18 @@ impl GPUBuffer { impl Drop for GPUBuffer { fn drop(&mut self) { - if let Err(e) = self.Destroy() { - error!("GPUBuffer destruction failed with {e:?}!"); // TODO: should we allow panic here? + if matches!(self.state(), GPUBufferState::Destroyed) { + return; + } + if let Err(e) = self + .channel + .0 + .send((None, WebGPURequest::DropBuffer(self.buffer.0))) + { + warn!( + "Failed to send WebGPURequest::DropBuffer({:?}) ({})", + self.buffer.0, e + ); }; } } |