Title: [215025] releases/WebKitGTK/webkit-2.14/Source/WebCore
Revision
215025
Author
carlo...@webkit.org
Date
2017-04-06 05:38:37 -0700 (Thu, 06 Apr 2017)

Log Message

Merge r212968 - [GTK] WebkitWebProcess crashes on exit on nvidia if threaded compositing is enabled
https://bugs.webkit.org/show_bug.cgi?id=165522

Reviewed by Carlos Garcia Campos.

Before destrying a GLContextGLX we need to set the default framebufer to avoid a bug
in some nvidia drivers. Ensure that we set the context as current before performing
that operation, and set the appropriate current context after doing so.

No new tests.

* platform/graphics/glx/GLContextGLX.cpp:
(WebCore::GLContextGLX::~GLContextGLX):

Modified Paths

Diff

Modified: releases/WebKitGTK/webkit-2.14/Source/WebCore/ChangeLog (215024 => 215025)


--- releases/WebKitGTK/webkit-2.14/Source/WebCore/ChangeLog	2017-04-06 12:37:48 UTC (rev 215024)
+++ releases/WebKitGTK/webkit-2.14/Source/WebCore/ChangeLog	2017-04-06 12:38:37 UTC (rev 215025)
@@ -1,3 +1,19 @@
+2017-02-24  Miguel Gomez  <mago...@igalia.com>
+
+        [GTK] WebkitWebProcess crashes on exit on nvidia if threaded compositing is enabled
+        https://bugs.webkit.org/show_bug.cgi?id=165522
+
+        Reviewed by Carlos Garcia Campos.
+
+        Before destrying a GLContextGLX we need to set the default framebufer to avoid a bug
+        in some nvidia drivers. Ensure that we set the context as current before performing
+        that operation, and set the appropriate current context after doing so.
+
+        No new tests.
+
+        * platform/graphics/glx/GLContextGLX.cpp:
+        (WebCore::GLContextGLX::~GLContextGLX):
+
 2017-02-23  Carlos Garcia Campos  <cgar...@igalia.com>
 
         [GStreamer] Several layout tests trigger GStreamer-CRITICAL **: gst_bin_get_by_name: assertion 'GST_IS_BIN (bin)' failed

Modified: releases/WebKitGTK/webkit-2.14/Source/WebCore/platform/graphics/glx/GLContextGLX.cpp (215024 => 215025)


--- releases/WebKitGTK/webkit-2.14/Source/WebCore/platform/graphics/glx/GLContextGLX.cpp	2017-04-06 12:37:48 UTC (rev 215024)
+++ releases/WebKitGTK/webkit-2.14/Source/WebCore/platform/graphics/glx/GLContextGLX.cpp	2017-04-06 12:38:37 UTC (rev 215025)
@@ -278,8 +278,21 @@
         cairo_device_destroy(m_cairoDevice);
 
     if (m_context) {
+        // Due to a bug in some nvidia drivers, we need bind the default framebuffer in a context before
+        // destroying it to avoid a crash. In order to do that, we need to make the context current and,
+        // after the bind change, we need to set the previous context again.
+        GLContext* previousActiveContext = GLContext::current();
+        makeContextCurrent();
         glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, 0);
-        glXMakeCurrent(m_x11Display, None, None);
+        if (previousActiveContext && previousActiveContext != this) {
+            // If there was a previous context different from this one, just make it current again.
+            previousActiveContext->makeContextCurrent();
+        } else {
+            // If there was no previous context or this was the previous, set a void context as current.
+            // We use the GLX function here, and the destructor of GLContext will clean the pointer
+            // returned by GLContext::current().
+            glXMakeCurrent(m_x11Display, None, None);
+        }
     }
 }
 
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to