Title: [210155] releases/WebKitGTK/webkit-2.14/Source/WebCore
Revision
210155
Author
[email protected]
Date
2016-12-27 02:33:36 -0800 (Tue, 27 Dec 2016)

Log Message

Merge r205544 - [GTK] Crash of WebProcess on the last WebView disconnect
https://bugs.webkit.org/show_bug.cgi?id=161605

Reviewed by Michael Catanzaro.

Stop tracking X11 GL contexts to be cleanered on an exit handler. This was added to work around bugs on drivers,
and it's assuming that all GLContext not deleted when the exit handler is called are leaked, which is no longer
true, because PlatformDisplay now owns a GLContext and is deleted after exit handlers.

* platform/graphics/GLContext.cpp:
(WebCore::GLContext::GLContext):
(WebCore::GLContext::~GLContext):
(WebCore::activeContextList): Deleted.
(WebCore::GLContext::addActiveContext): Deleted.
(WebCore::GLContext::removeActiveContext): Deleted.
(WebCore::GLContext::cleanupActiveContextsAtExit): Deleted.

Modified Paths

Diff

Modified: releases/WebKitGTK/webkit-2.14/Source/WebCore/ChangeLog (210154 => 210155)


--- releases/WebKitGTK/webkit-2.14/Source/WebCore/ChangeLog	2016-12-27 10:33:25 UTC (rev 210154)
+++ releases/WebKitGTK/webkit-2.14/Source/WebCore/ChangeLog	2016-12-27 10:33:36 UTC (rev 210155)
@@ -1,3 +1,22 @@
+2016-09-07  Carlos Garcia Campos  <[email protected]>
+
+        [GTK] Crash of WebProcess on the last WebView disconnect
+        https://bugs.webkit.org/show_bug.cgi?id=161605
+
+        Reviewed by Michael Catanzaro.
+
+        Stop tracking X11 GL contexts to be cleanered on an exit handler. This was added to work around bugs on drivers,
+        and it's assuming that all GLContext not deleted when the exit handler is called are leaked, which is no longer
+        true, because PlatformDisplay now owns a GLContext and is deleted after exit handlers.
+
+        * platform/graphics/GLContext.cpp:
+        (WebCore::GLContext::GLContext):
+        (WebCore::GLContext::~GLContext):
+        (WebCore::activeContextList): Deleted.
+        (WebCore::GLContext::addActiveContext): Deleted.
+        (WebCore::GLContext::removeActiveContext): Deleted.
+        (WebCore::GLContext::cleanupActiveContextsAtExit): Deleted.
+
 2016-09-13  Dean Jackson  <[email protected]>
 
         Remove a .rej file.

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


--- releases/WebKitGTK/webkit-2.14/Source/WebCore/platform/graphics/glx/GLContextGLX.cpp	2016-12-27 10:33:25 UTC (rev 210154)
+++ releases/WebKitGTK/webkit-2.14/Source/WebCore/platform/graphics/glx/GLContextGLX.cpp	2016-12-27 10:33:36 UTC (rev 210155)
@@ -35,25 +35,6 @@
 
 namespace WebCore {
 
-// Because of driver bugs, exiting the program when there are active pbuffers
-// can crash the X server (this has been observed with the official Nvidia drivers).
-// We need to ensure that we clean everything up on exit. There are several reasons
-// that GraphicsContext3Ds will still be alive at exit, including user error (memory
-// leaks) and the page cache. In any case, we don't want the X server to crash.
-static HashSet<GLContextGLX*>& activeContexts()
-{
-    static std::once_flag onceFlag;
-    static LazyNeverDestroyed<HashSet<GLContextGLX*>> contexts;
-    std::call_once(onceFlag, [] {
-        contexts.construct();
-        std::atexit([] {
-            for (auto* context : activeContexts())
-                context->clear();
-        });
-    });
-    return contexts;
-}
-
 #if !defined(PFNGLXSWAPINTERVALSGIPROC)
 typedef int (*PFNGLXSWAPINTERVALSGIPROC) (int);
 #endif
@@ -182,7 +163,6 @@
     , m_context(WTFMove(context))
     , m_window(static_cast<Window>(window))
 {
-    activeContexts().add(this);
 }
 
 GLContextGLX::GLContextGLX(PlatformDisplay& display, XUniqueGLXContext&& context, XUniqueGLXPbuffer&& pbuffer)
@@ -190,7 +170,6 @@
     , m_context(WTFMove(context))
     , m_pbuffer(WTFMove(pbuffer))
 {
-    activeContexts().add(this);
 }
 
 GLContextGLX::GLContextGLX(PlatformDisplay& display, XUniqueGLXContext&& context, XUniquePixmap&& pixmap, XUniqueGLXPixmap&& glxPixmap)
@@ -199,31 +178,17 @@
     , m_pixmap(WTFMove(pixmap))
     , m_glxPixmap(WTFMove(glxPixmap))
 {
-    activeContexts().add(this);
 }
 
 GLContextGLX::~GLContextGLX()
 {
-    clear();
-    activeContexts().remove(this);
-}
+    if (m_cairoDevice)
+        cairo_device_destroy(m_cairoDevice);
 
-void GLContextGLX::clear()
-{
-    if (!m_context)
-        return;
-
-    if (m_cairoDevice) {
-        cairo_device_destroy(m_cairoDevice);
-        m_cairoDevice = nullptr;
+    if (m_context) {
+        glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, 0);
+        glXMakeCurrent(downcast<PlatformDisplayX11>(m_display).native(), None, None);
     }
-
-    // This may be necessary to prevent crashes with NVidia's closed source drivers. Originally
-    // from Mozilla's 3D canvas implementation at: http://bitbucket.org/ilmari/canvas3d/
-    glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, 0);
-    glXMakeCurrent(downcast<PlatformDisplayX11>(m_display).native(), None, None);
-
-    m_context = nullptr;
 }
 
 bool GLContextGLX::canRenderToDefaultFramebuffer()

Modified: releases/WebKitGTK/webkit-2.14/Source/WebCore/platform/graphics/glx/GLContextGLX.h (210154 => 210155)


--- releases/WebKitGTK/webkit-2.14/Source/WebCore/platform/graphics/glx/GLContextGLX.h	2016-12-27 10:33:25 UTC (rev 210154)
+++ releases/WebKitGTK/webkit-2.14/Source/WebCore/platform/graphics/glx/GLContextGLX.h	2016-12-27 10:33:36 UTC (rev 210155)
@@ -39,8 +39,6 @@
 
     virtual ~GLContextGLX();
 
-    void clear();
-
 private:
     bool makeContextCurrent() override;
     void swapBuffers() override;
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to