diff options
Diffstat (limited to 'dom/webgpu/BindGroup.cpp')
-rw-r--r-- | dom/webgpu/BindGroup.cpp | 20 |
1 files changed, 14 insertions, 6 deletions
diff --git a/dom/webgpu/BindGroup.cpp b/dom/webgpu/BindGroup.cpp index 7ae5b8c3bb..b3cd3d9d5e 100644 --- a/dom/webgpu/BindGroup.cpp +++ b/dom/webgpu/BindGroup.cpp @@ -22,13 +22,21 @@ BindGroup::BindGroup(Device* const aParent, RawId aId) BindGroup::~BindGroup() { Cleanup(); } void BindGroup::Cleanup() { - if (mValid && mParent) { - mValid = false; - auto bridge = mParent->GetBridge(); - if (bridge && bridge->IsOpen()) { - bridge->SendBindGroupDrop(mId); - } + if (!mValid) { + return; } + mValid = false; + + auto bridge = mParent->GetBridge(); + if (!bridge) { + return; + } + + if (bridge->CanSend()) { + bridge->SendBindGroupDrop(mId); + } + + wgpu_client_free_bind_group_id(bridge->GetClient(), mId); } } // namespace mozilla::webgpu |