Title: [184191] releases/WebKitGTK/webkit-2.8/Source/WebCore
Revision
184191
Author
[email protected]
Date
2015-05-12 02:35:22 -0700 (Tue, 12 May 2015)

Log Message

Merge r184154 - Clean up redundant resources in case of failure in GLContextEGL context creation methods
https://bugs.webkit.org/show_bug.cgi?id=144878

Reviewed by Martin Robinson.

GLContextEGL::createWindowContext() and GLContextEGL::createPixmapContext() methods
should clean up the freshly-created resources when prematurely returning due to a
failure.

* platform/graphics/egl/GLContextEGL.cpp:
(WebCore::GLContextEGL::createWindowContext):
(WebCore::GLContextEGL::createPixmapContext):

Modified Paths

Diff

Modified: releases/WebKitGTK/webkit-2.8/Source/WebCore/ChangeLog (184190 => 184191)


--- releases/WebKitGTK/webkit-2.8/Source/WebCore/ChangeLog	2015-05-12 09:25:39 UTC (rev 184190)
+++ releases/WebKitGTK/webkit-2.8/Source/WebCore/ChangeLog	2015-05-12 09:35:22 UTC (rev 184191)
@@ -1,3 +1,18 @@
+2015-05-11  Zan Dobersek  <[email protected]>
+
+        Clean up redundant resources in case of failure in GLContextEGL context creation methods
+        https://bugs.webkit.org/show_bug.cgi?id=144878
+
+        Reviewed by Martin Robinson.
+
+        GLContextEGL::createWindowContext() and GLContextEGL::createPixmapContext() methods
+        should clean up the freshly-created resources when prematurely returning due to a
+        failure.
+
+        * platform/graphics/egl/GLContextEGL.cpp:
+        (WebCore::GLContextEGL::createWindowContext):
+        (WebCore::GLContextEGL::createPixmapContext):
+
 2015-05-11  Antti Koivisto  <[email protected]>
 
         WebContent crash under com.apple.WebCore: WebCore::WebKitCSSResourceValue::isCSSValueNone const + 6

Modified: releases/WebKitGTK/webkit-2.8/Source/WebCore/platform/graphics/egl/GLContextEGL.cpp (184190 => 184191)


--- releases/WebKitGTK/webkit-2.8/Source/WebCore/platform/graphics/egl/GLContextEGL.cpp	2015-05-12 09:25:39 UTC (rev 184190)
+++ releases/WebKitGTK/webkit-2.8/Source/WebCore/platform/graphics/egl/GLContextEGL.cpp	2015-05-12 09:35:22 UTC (rev 184191)
@@ -138,8 +138,10 @@
         return nullptr;
 
     EGLSurface surface = eglCreateWindowSurface(display, config, window, 0);
-    if (surface == EGL_NO_SURFACE)
+    if (surface == EGL_NO_SURFACE) {
+        eglDestroyContext(display, context);
         return nullptr;
+    }
 
     return std::make_unique<GLContextEGL>(context, surface, WindowSurface);
 }
@@ -184,17 +186,24 @@
         return nullptr;
 
     EGLint depth;
-    if (!eglGetConfigAttrib(display, config, EGL_DEPTH_SIZE, &depth))
+    if (!eglGetConfigAttrib(display, config, EGL_DEPTH_SIZE, &depth)) {
+        eglDestroyContext(display, context);
         return nullptr;
+    }
 
     Pixmap pixmap = XCreatePixmap(sharedX11Display(), DefaultRootWindow(sharedX11Display()), 1, 1, depth);
-    if (!pixmap)
+    if (!pixmap) {
+        eglDestroyContext(display, context);
         return nullptr;
+    }
 
     EGLSurface surface = eglCreatePixmapSurface(display, config, pixmap, 0);
 
-    if (surface == EGL_NO_SURFACE)
+    if (surface == EGL_NO_SURFACE) {
+        XFreePixmap(sharedX11Display(), pixmap);
+        eglDestroyContext(display, context);
         return nullptr;
+    }
 
     return std::make_unique<GLContextEGL>(context, surface, PixmapSurface);
 #else
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to