diff --git a/dom/webgpu/CanvasContext.cpp b/dom/webgpu/CanvasContext.cpp index 724ea46b2a59..ab42f7c6ffb8 100644 --- a/dom/webgpu/CanvasContext.cpp +++ b/dom/webgpu/CanvasContext.cpp @@ -32,7 +32,10 @@ CanvasContext::CanvasContext() : mExternalImageId(layers::CompositorManagerChild::GetInstance() ->GetNextExternalImageId()) {} -CanvasContext::~CanvasContext() { Cleanup(); } +CanvasContext::~CanvasContext() { + Cleanup(); + RemovePostRefreshObserver(); +} void CanvasContext::Cleanup() { if (mSwapChain) {