Changeset 205544 in webkit


Ignore:
Timestamp:
Sep 7, 2016 6:47:02 AM (8 years ago)
Author:
Carlos Garcia Campos
Message:

[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.

Location:
trunk/Source/WebCore
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r205542 r205544  
     12016-09-07  Carlos Garcia Campos  <cgarcia@igalia.com>
     2
     3        [GTK] Crash of WebProcess on the last WebView disconnect
     4        https://bugs.webkit.org/show_bug.cgi?id=161605
     5
     6        Reviewed by Michael Catanzaro.
     7
     8        Stop tracking X11 GL contexts to be cleanered on an exit handler. This was added to work around bugs on drivers,
     9        and it's assuming that all GLContext not deleted when the exit handler is called are leaked, which is no longer
     10        true, because PlatformDisplay now owns a GLContext and is deleted after exit handlers.
     11
     12        * platform/graphics/GLContext.cpp:
     13        (WebCore::GLContext::GLContext):
     14        (WebCore::GLContext::~GLContext):
     15        (WebCore::activeContextList): Deleted.
     16        (WebCore::GLContext::addActiveContext): Deleted.
     17        (WebCore::GLContext::removeActiveContext): Deleted.
     18        (WebCore::GLContext::cleanupActiveContextsAtExit): Deleted.
     19
    1202016-09-07  Nael Ouedraogo  <nael.ouedraogo@crf.canon.fr>
    221
  • trunk/Source/WebCore/platform/graphics/GLContext.cpp

    r205116 r205544  
    5454    return *ThreadGlobalGLContext::staticGLContext;
    5555}
    56 
    57 #if PLATFORM(X11)
    58 // Because of driver bugs, exiting the program when there are active pbuffers
    59 // can crash the X server (this has been observed with the official Nvidia drivers).
    60 // We need to ensure that we clean everything up on exit. There are several reasons
    61 // that GraphicsContext3Ds will still be alive at exit, including user error (memory
    62 // leaks) and the page cache. In any case, we don't want the X server to crash.
    63 typedef Vector<GLContext*> ActiveContextList;
    64 static ActiveContextList& activeContextList()
    65 {
    66     DEPRECATED_DEFINE_STATIC_LOCAL(ActiveContextList, activeContexts, ());
    67     return activeContexts;
    68 }
    69 
    70 void GLContext::addActiveContext(GLContext* context)
    71 {
    72     static bool addedAtExitHandler = false;
    73     if (!addedAtExitHandler) {
    74         atexit(&GLContext::cleanupActiveContextsAtExit);
    75         addedAtExitHandler = true;
    76     }
    77     activeContextList().append(context);
    78 }
    79 
    80 static bool gCleaningUpAtExit = false;
    81 
    82 void GLContext::removeActiveContext(GLContext* context)
    83 {
    84     // If we are cleaning up the context list at exit, don't bother removing the context
    85     // from the list, since we don't want to modify the list while it's being iterated.
    86     if (gCleaningUpAtExit)
    87         return;
    88 
    89     ActiveContextList& contextList = activeContextList();
    90     size_t i = contextList.find(context);
    91     if (i != notFound)
    92         contextList.remove(i);
    93 }
    94 
    95 void GLContext::cleanupActiveContextsAtExit()
    96 {
    97     gCleaningUpAtExit = true;
    98 
    99     ActiveContextList& contextList = activeContextList();
    100     for (size_t i = 0; i < contextList.size(); ++i)
    101         delete contextList[i];
    102 }
    103 #endif // PLATFORM(X11)
    10456
    10557static bool initializeOpenGLShimsIfNeeded()
     
    179131    : m_display(display)
    180132{
    181 #if PLATFORM(X11)
    182     if (display.type() == PlatformDisplay::Type::X11)
    183         addActiveContext(this);
    184 #endif
    185133}
    186134
     
    189137    if (this == currentContext()->context())
    190138        currentContext()->setContext(nullptr);
    191 #if PLATFORM(X11)
    192     if (m_display.type() == PlatformDisplay::Type::X11)
    193         removeActiveContext(this);
    194 #endif
    195139}
    196140
Note: See TracChangeset for help on using the changeset viewer.