From 41be85bf4ff0bfbda90b7738b7d63490a67ed2d8 Mon Sep 17 00:00:00 2001 From: Benoit Jacob Date: Sat, 21 Apr 2012 16:48:22 -0400 Subject: [PATCH] Bug 736481 - 6/7 - WebGL lost context handling: check if we still have a canvas - r=jgilbert, a=blocking-fennec --- content/canvas/src/WebGLContext.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/content/canvas/src/WebGLContext.cpp b/content/canvas/src/WebGLContext.cpp index 2672551ecc6..b5763ebd591 100644 --- a/content/canvas/src/WebGLContext.cpp +++ b/content/canvas/src/WebGLContext.cpp @@ -1055,6 +1055,13 @@ NS_IMETHODIMP WebGLContext::Notify(nsITimer* timer) { TerminateContextLossTimer(); + + if (!HTMLCanvasElement()) { + // the canvas is gone. That happens when the page was closed before we got + // this timer event. In this case, there's nothing to do here, just don't crash. + return NS_OK; + } + // If the context has been lost and we're waiting for it to be restored, do // that now. if (mContextStatus == ContextLostAwaitingEvent) {