Title: [113123] trunk/Source/WebCore
Revision
113123
Author
[email protected]
Date
2012-04-03 18:44:10 -0700 (Tue, 03 Apr 2012)

Log Message

[Qt] Crash in ~GraphicsContext3D() when init failed
https://bugs.webkit.org/show_bug.cgi?id=82992

Patch by Srikumar Bonda <[email protected]> on 2012-04-03
Reviewed by Luiz Agostini.

WebKit crashes in ~GraphicsContext3D() while freeing the variables which are
not even allocated because of the init failure in GraphicsContext3D() for Qt.
In addition, Added a safety check in makeContextCurrent() before accessing
GraphicsContext3DPrivate object.

No new tests because the change is about adding null check
before accessing the variables.

* platform/graphics/qt/GraphicsContext3DQt.cpp:
(WebCore::GraphicsContext3D::~GraphicsContext3D):
(WebCore::GraphicsContext3D::makeContextCurrent):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (113122 => 113123)


--- trunk/Source/WebCore/ChangeLog	2012-04-04 01:40:39 UTC (rev 113122)
+++ trunk/Source/WebCore/ChangeLog	2012-04-04 01:44:10 UTC (rev 113123)
@@ -1,3 +1,22 @@
+2012-04-03  Srikumar Bonda  <[email protected]>
+
+        [Qt] Crash in ~GraphicsContext3D() when init failed
+        https://bugs.webkit.org/show_bug.cgi?id=82992
+
+        Reviewed by Luiz Agostini.
+
+        WebKit crashes in ~GraphicsContext3D() while freeing the variables which are
+        not even allocated because of the init failure in GraphicsContext3D() for Qt.
+        In addition, Added a safety check in makeContextCurrent() before accessing
+        GraphicsContext3DPrivate object.
+
+        No new tests because the change is about adding null check
+        before accessing the variables.
+
+        * platform/graphics/qt/GraphicsContext3DQt.cpp:
+        (WebCore::GraphicsContext3D::~GraphicsContext3D):
+        (WebCore::GraphicsContext3D::makeContextCurrent):
+
 2012-04-03  Rafael Weinstein  <[email protected]>
 
         Use V8 completion callback API to assert that V8RecursionScope is on the stack whenever invoking script

Modified: trunk/Source/WebCore/platform/graphics/qt/GraphicsContext3DQt.cpp (113122 => 113123)


--- trunk/Source/WebCore/platform/graphics/qt/GraphicsContext3DQt.cpp	2012-04-04 01:40:39 UTC (rev 113122)
+++ trunk/Source/WebCore/platform/graphics/qt/GraphicsContext3DQt.cpp	2012-04-04 01:44:10 UTC (rev 113123)
@@ -348,6 +348,9 @@
 
 GraphicsContext3D::~GraphicsContext3D()
 {
+    // If GraphicsContext3D init failed in constructor, m_private set to nullptr and no buffers are allocated.
+    if (!m_private)
+        return;
     makeContextCurrent();
     glDeleteTextures(1, &m_texture);
     glDeleteFramebuffers(1, &m_fbo);
@@ -387,6 +390,8 @@
 
 bool GraphicsContext3D::makeContextCurrent()
 {
+    if (!m_private)
+        return false;
     return m_private->makeCurrentIfNeeded();
 }
 
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to