Proper GPUDevice cleanup (#32520)

* Make device cleanup right

* Use weakref for GPUDevice in globalscope

* No need to destroy device on drop

* DeviceReason early return

* make remove_gpu_device to be the only way to remove device
This commit is contained in:
Samson 2024-06-20 07:56:59 +02:00 committed by GitHub
parent 256c55eb81
commit bf99cf7f30
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
6 changed files with 89 additions and 43 deletions

View file

@ -1031,13 +1031,6 @@ impl AsyncWGPUListener for GPUDevice {
impl Drop for GPUDevice {
fn drop(&mut self) {
if let Err(e) = self
.channel
.0
.send(WebGPURequest::DestroyDevice(self.device.0))
{
warn!("Failed to send DestroyDevice ({:?}) ({})", self.device.0, e);
}
if let Err(e) = self
.channel
.0