[Chromium] Crash in Canvas2DLayerChromium::pushPropertiesTo
authorcommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 26 Mar 2012 22:59:53 +0000 (22:59 +0000)
committercommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 26 Mar 2012 22:59:53 +0000 (22:59 +0000)
https://bugs.webkit.org/show_bug.cgi?id=82243

Patch by Justin Novosad <junov@chromium.org> on 2012-03-26
Reviewed by James Robinson.

Adding null pointer check to prevent crash and texture object
validity check to prevent potential graphics glitch

* platform/graphics/chromium/Canvas2DLayerChromium.cpp:
(WebCore::Canvas2DLayerChromium::pushPropertiesTo):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@112165 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Source/WebCore/ChangeLog
Source/WebCore/platform/graphics/chromium/Canvas2DLayerChromium.cpp

index c525aad361b5890b47bb65b9fb0d281c0a3b1ec6..e99fe2a73985633ebe805cd15133bba838ea1306 100644 (file)
@@ -1,3 +1,16 @@
+2012-03-26  Justin Novosad  <junov@chromium.org>
+
+        [Chromium] Crash in Canvas2DLayerChromium::pushPropertiesTo
+        https://bugs.webkit.org/show_bug.cgi?id=82243
+
+        Reviewed by James Robinson.
+
+        Adding null pointer check to prevent crash and texture object
+        validity check to prevent potential graphics glitch
+
+        * platform/graphics/chromium/Canvas2DLayerChromium.cpp:
+        (WebCore::Canvas2DLayerChromium::pushPropertiesTo):
+
 2012-03-26  Adam Klein  <adamk@chromium.org>
 
         Use PassRefPtr in V8DOMWrapper interface to avoid explicit ref() calls
 2012-03-26  Adam Klein  <adamk@chromium.org>
 
         Use PassRefPtr in V8DOMWrapper interface to avoid explicit ref() calls
index 7003826d70e18c32aadb184632122db5b221270d..1d3d369a1395031ef0d6072df08a2e9d3260ed26 100644 (file)
@@ -154,9 +154,12 @@ void Canvas2DLayerChromium::pushPropertiesTo(CCLayerImpl* layer)
     CanvasLayerChromium::pushPropertiesTo(layer);
 
     CCTextureLayerImpl* textureLayer = static_cast<CCTextureLayerImpl*>(layer);
     CanvasLayerChromium::pushPropertiesTo(layer);
 
     CCTextureLayerImpl* textureLayer = static_cast<CCTextureLayerImpl*>(layer);
-    if (m_useDoubleBuffering)
-        textureLayer->setTextureId(m_frontTexture->textureId());
-    else
+    if (m_useDoubleBuffering) {
+        if (m_frontTexture && m_frontTexture->isValid(m_size, GraphicsContext3D::RGBA))
+            textureLayer->setTextureId(m_frontTexture->textureId());
+        else
+            textureLayer->setTextureId(0);
+    } else
         textureLayer->setTextureId(m_backTextureId);
 }
 
         textureLayer->setTextureId(m_backTextureId);
 }