Bug 673378 - Crash at nsHTMLCanvasElement::GetContext - r=roc
authorBenoit Jacob <bjacob@mozilla.com>
Wed, 03 Aug 2011 19:35:56 -0400
changeset 73761 f12f16210f30
parent 73760 1dddaeb1366b
child 73762 c19fbc9ec649
push id20915
push userbjacob@mozilla.com
push dateWed, 03 Aug 2011 23:36:17 +0000
treeherdermozilla-central@f12f16210f30 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersroc
bugs673378
milestone8.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
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
--- a/content/html/content/src/nsHTMLCanvasElement.cpp
+++ b/content/html/content/src/nsHTMLCanvasElement.cpp
@@ -576,28 +576,31 @@ nsHTMLCanvasElement::UpdateContext(nsIPr
     return NS_OK;
 
   nsresult rv = NS_OK;
   nsIntSize sz = GetWidthHeight();
 
   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;
   }
 
   return rv;
 }
 
 nsIFrame *
 nsHTMLCanvasElement::GetPrimaryCanvasFrame()