Bug 1596245 - Fix WebGPU device destruction r=jgilbert
authorDzmitry Malyshau <dmalyshau@mozilla.com>
Thu, 14 Nov 2019 21:22:56 +0000
changeset 502040 80763bd78330a116ee0e201bed08eecbeceabe4b
parent 502039 b128903fea7457452171d43c599a6d67719eb3d9
child 502041 6295568b6ea47d638c4346effd4731d37366547b
push id114172
push userdluca@mozilla.com
push dateTue, 19 Nov 2019 11:31:10 +0000
treeherdermozilla-inbound@b5c5ba07d3db [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjgilbert
bugs1596245
milestone72.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1596245 - Fix WebGPU device destruction r=jgilbert Differential Revision: https://phabricator.services.mozilla.com/D53081
dom/webgpu/Device.cpp
--- a/dom/webgpu/Device.cpp
+++ b/dom/webgpu/Device.cpp
@@ -19,17 +19,18 @@ GPU_IMPL_JS_WRAP(Device)
 Device::Device(Adapter* const aParent, RawId aId)
     : DOMEventTargetHelper(aParent->GetParentObject()),
       mBridge(aParent->GetBridge()),
       mId(aId) {
   Unused << mId;  // TODO: remove
 }
 
 Device::~Device() {
-  if (mBridge->IsOpen()) {
+  //TODO: figure out when `mBridge` could be `nullptr`
+  if (mBridge && mBridge->IsOpen()) {
     mBridge->SendDeviceDestroy(mId);
   }
 }
 
 void Device::GetLabel(nsAString& aValue) const { aValue = mLabel; }
 void Device::SetLabel(const nsAString& aLabel) { mLabel = aLabel; }
 
 }  // namespace webgpu