<rdar://problem/5974306> CanvasRenderingContext2D becomes invalid when source canvas...
[WebKit-https.git] / WebCore / html / HTMLCanvasElement.cpp
index 48ee226..907cccc 100644 (file)
@@ -78,8 +78,6 @@ HTMLCanvasElement::HTMLCanvasElement(Document* doc)
 
 HTMLCanvasElement::~HTMLCanvasElement()
 {
-    if (m_2DContext)
-        m_2DContext->detachCanvas();
 }
 
 #if ENABLE(DASHBOARD_SUPPORT)
@@ -154,7 +152,7 @@ CanvasRenderingContext* HTMLCanvasElement::getContext(const String& type)
 {
     if (type == "2d") {
         if (!m_2DContext)
-            m_2DContext = CanvasRenderingContext2D::create(this);
+            m_2DContext.set(new CanvasRenderingContext2D(this));
         return m_2DContext.get();
     }
     return 0;