| Differences between
and this patch
- a/Source/WebCore/ChangeLog +19 lines
Lines 1-3 a/Source/WebCore/ChangeLog_sec1
1
2016-06-01  Carlos Garcia Campos  <cgarcia@igalia.com>
2
3
        [Wayland] PlatformDisplayWayland destructor is super crashy
4
        https://bugs.webkit.org/show_bug.cgi?id=157973
5
6
        Reviewed by NOBODY (OOPS!).
7
8
        EGL registers two at exist callbacks one to finish the display and another one to unload drivers, the one to
9
        finish the display happens first. When our destructor is called the _eglFiniDisplay callback has already been
10
        called, so we have a valid pointer for an already finished display. Then eglTerminate tries to find the display
11
        in the global display list, but fails and for some reason it crashes when trying to return an error.
12
        If atexit is called after the global PlatformDisplay constructor, the atexit handler is called before the
13
        destructor. The atexit callbacks are called in reverse order, so if we register an atexit handler after the
14
        global instace has been created and after EGL has been initialized, we could terminate the EGL display before
15
        the EGL atexit handlers and the global PlatformDisplay destructor.
16
17
        * platform/graphics/PlatformDisplay.cpp:
18
        (WebCore::PlatformDisplay::initializeEGLDisplay):
19
1
2016-06-01  Per Arne Vollan  <pvollan@apple.com>
20
2016-06-01  Per Arne Vollan  <pvollan@apple.com>
2
21
3
        [Win][IndexedDB] Crash when running blob test.
22
        [Win][IndexedDB] Crash when running blob test.
- a/Source/WebCore/platform/graphics/PlatformDisplay.cpp +10 lines
Lines 159-164 void PlatformDisplay::initializeEGLDisplay() a/Source/WebCore/platform/graphics/PlatformDisplay.cpp_sec1
159
        terminateEGLDisplay();
159
        terminateEGLDisplay();
160
        return;
160
        return;
161
    }
161
    }
162
163
    // EGL registers atexit handlers to cleanup its global display list.
164
    // Since the global PlatformDisplay instance is created before,
165
    // when the PlatformDisplay destructor is called, EGL has already removed the
166
    // display from the list, causing eglTerminate() to crash. So, here we register
167
    // our own atexit handler, after EGL has been initialized and after the global
168
    // instance has been created to ensure we call eglTerminate() before the other
169
    // EGL atexit handlers and the PlatformDisplay destructor.
170
    // See https://bugs.webkit.org/show_bug.cgi?id=157973.
171
    std::atexit([] { PlatformDisplay::sharedDisplay().terminateEGLDisplay(); });
162
}
172
}
163
173
164
void PlatformDisplay::terminateEGLDisplay()
174
void PlatformDisplay::terminateEGLDisplay()

Return to Bug 157973