commit 25a90a49e0933420195ab9c728a2c85a63409357
parent ce1089cbbcb459374732695189fc42a12e388eed
Author: Andy Leiserson <andy@leiserson.org>
Date: Mon, 8 Dec 2025 19:28:34 +0000
Bug 1999700 - Hold a strong ref to device during promise cleanup r=webgpu-reviewers,ErichDonGubler
Differential Revision: https://phabricator.services.mozilla.com/D274878
Diffstat:
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/dom/webgpu/ipc/WebGPUChild.cpp b/dom/webgpu/ipc/WebGPUChild.cpp
@@ -370,10 +370,10 @@ ipc::IPCResult WebGPUChild::RecvUncapturedError(RawId aDeviceId,
const nsACString& aMessage) {
MOZ_RELEASE_ASSERT(aDeviceId);
- WeakPtr<Device> device;
+ RefPtr<Device> device;
const auto itr = mDeviceMap.find(aDeviceId);
if (itr != mDeviceMap.end()) {
- device = itr->second;
+ device = itr->second.get();
}
if (!device) {
@@ -412,7 +412,7 @@ ipc::IPCResult WebGPUChild::RecvDeviceLost(RawId aDeviceId, uint8_t aReason,
const auto itr = mDeviceMap.find(aDeviceId);
if (itr != mDeviceMap.end()) {
- WeakPtr<Device> device = itr->second;
+ RefPtr<Device> device = itr->second.get();
if (!device) {
return IPC_OK();
@@ -498,7 +498,7 @@ void WebGPUChild::ClearActorState() {
// Empty device map and resolve all lost promises with an "unknown" reason.
else if (!mDeviceMap.empty()) {
auto device_map_entry = mDeviceMap.begin();
- WeakPtr<Device> device = device_map_entry->second;
+ RefPtr<Device> device = device_map_entry->second.get();
mDeviceMap.erase(device_map_entry->first);
if (device) {