Bug 1758070 - Null out mContext during shutdown. r=emilio, a=tritter
Differential Revision:
https://phabricator.services.mozilla.com/D140336
--- a/dom/webgpu/ipc/WebGPUParent.cpp
+++ b/dom/webgpu/ipc/WebGPUParent.cpp
@@ -731,16 +731,17 @@ ipc::IPCResult WebGPUParent::RecvShutdow
mTimer.Stop();
for (const auto& p : mCanvasMap) {
const wr::ExternalImageId extId = {p.first};
layers::TextureHost::DestroyRenderTexture(extId);
}
mCanvasMap.clear();
ffi::wgpu_server_poll_all_devices(mContext, true);
ffi::wgpu_server_delete(const_cast<ffi::WGPUGlobal*>(mContext));
+ mContext = nullptr;
return IPC_OK();
}
ipc::IPCResult WebGPUParent::RecvDeviceAction(RawId aSelf,
const ipc::ByteBuf& aByteBuf) {
ErrorBuffer error;
ffi::wgpu_server_device_action(mContext, aSelf, ToFFI(&aByteBuf),
error.ToFFI());
--- a/dom/webgpu/ipc/WebGPUParent.h
+++ b/dom/webgpu/ipc/WebGPUParent.h
@@ -89,17 +89,17 @@ class WebGPUParent final : public PWebGP
ipc::IPCResult RecvShutdown();
private:
virtual ~WebGPUParent();
void MaintainDevices();
bool ForwardError(RawId aDeviceID, ErrorBuffer& aError);
- const ffi::WGPUGlobal* const mContext;
+ const ffi::WGPUGlobal* mContext;
base::RepeatingTimer<WebGPUParent> mTimer;
/// Shmem associated with a mappable buffer has to be owned by one of the
/// processes. We keep it here for every mappable buffer while the buffer is
/// used by GPU.
std::unordered_map<uint64_t, Shmem> mSharedMemoryMap;
/// Associated presentation data for each swapchain.
std::unordered_map<uint64_t, RefPtr<PresentationData>> mCanvasMap;
/// Associated stack of error scopes for each device.