From e46f468b7212dd7159ae807e35c31b678caabe79 Mon Sep 17 00:00:00 2001 From: Benoit Jacob Date: Wed, 3 Aug 2011 19:35:56 -0400 Subject: [PATCH] Bug 673378 - Crash at nsHTMLCanvasElement::GetContext - r=roc When UpdateContext fails, we only reset mCurrentContext, and forgot to reset mCurrentContextId. --- content/html/content/src/nsHTMLCanvasElement.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/content/html/content/src/nsHTMLCanvasElement.cpp b/content/html/content/src/nsHTMLCanvasElement.cpp index bc7fed164716..92919ea305e4 100644 --- a/content/html/content/src/nsHTMLCanvasElement.cpp +++ b/content/html/content/src/nsHTMLCanvasElement.cpp @@ -581,18 +581,21 @@ nsHTMLCanvasElement::UpdateContext(nsIPropertyBag *aNewContextOptions) rv = mCurrentContext->SetIsOpaque(GetIsOpaque()); if (NS_FAILED(rv)) { mCurrentContext = nsnull; + mCurrentContextId.AssignLiteral(""); return rv; } rv = mCurrentContext->SetContextOptions(aNewContextOptions); if (NS_FAILED(rv)) { mCurrentContext = nsnull; + mCurrentContextId.AssignLiteral(""); return rv; } rv = mCurrentContext->SetDimensions(sz.width, sz.height); if (NS_FAILED(rv)) { mCurrentContext = nsnull; + mCurrentContextId.AssignLiteral(""); return rv; }