Title: [214688] trunk/Source
- Revision
- 214688
- Author
- [email protected]
- Date
- 2017-03-31 15:03:39 -0700 (Fri, 31 Mar 2017)
Log Message
[WinCairo] WebCore::PlatformDisplay::terminateEGLDisplay causes a crash in libGLESv2.dll while processing atexit
https://bugs.webkit.org/show_bug.cgi?id=170331
Patch by Fujii Hironori <[email protected]> on 2017-03-31
Reviewed by Michael Catanzaro.
Source/WebCore:
WebCore::PlatformDisplay uses atexit to destruct EGL displays
while exiting process. But, when the atexit will be processed,
heap of libGLESv2.dll would be already destructed and causing a
crash on Windows. Do not use atexit for Windows.
AppleWin port does not use PlatformDisplay. Thus, it does not have
this bug.
* platform/graphics/PlatformDisplay.cpp:
(WebCore::PlatformDisplay::initializeEGLDisplay): Do not use atexit for Windows.
(WebCore::PlatformDisplay::shutDownEglDisplays): Added.
* platform/graphics/PlatformDisplay.h: Added a declaration of shutDownEglDisplays.
Source/WebKit/win:
* WebKitDLL.cpp:
(shutDownWebKit): Call PlatformDisplay::shutDownEglDisplays in shutDownWebKit.
Modified Paths
Diff
Modified: trunk/Source/WebCore/ChangeLog (214687 => 214688)
--- trunk/Source/WebCore/ChangeLog 2017-03-31 21:46:42 UTC (rev 214687)
+++ trunk/Source/WebCore/ChangeLog 2017-03-31 22:03:39 UTC (rev 214688)
@@ -1,3 +1,23 @@
+2017-03-31 Fujii Hironori <[email protected]>
+
+ [WinCairo] WebCore::PlatformDisplay::terminateEGLDisplay causes a crash in libGLESv2.dll while processing atexit
+ https://bugs.webkit.org/show_bug.cgi?id=170331
+
+ Reviewed by Michael Catanzaro.
+
+ WebCore::PlatformDisplay uses atexit to destruct EGL displays
+ while exiting process. But, when the atexit will be processed,
+ heap of libGLESv2.dll would be already destructed and causing a
+ crash on Windows. Do not use atexit for Windows.
+
+ AppleWin port does not use PlatformDisplay. Thus, it does not have
+ this bug.
+
+ * platform/graphics/PlatformDisplay.cpp:
+ (WebCore::PlatformDisplay::initializeEGLDisplay): Do not use atexit for Windows.
+ (WebCore::PlatformDisplay::shutDownEglDisplays): Added.
+ * platform/graphics/PlatformDisplay.h: Added a declaration of shutDownEglDisplays.
+
2017-03-31 Yoav Weiss <[email protected]>
Remove PRELOAD_DEBUG related code.
Modified: trunk/Source/WebCore/platform/graphics/PlatformDisplay.cpp (214687 => 214688)
--- trunk/Source/WebCore/platform/graphics/PlatformDisplay.cpp 2017-03-31 21:46:42 UTC (rev 214687)
+++ trunk/Source/WebCore/platform/graphics/PlatformDisplay.cpp 2017-03-31 22:03:39 UTC (rev 214688)
@@ -207,6 +207,7 @@
eglDisplays().add(this);
+#if !PLATFORM(WIN)
static bool eglAtexitHandlerInitialized = false;
if (!eglAtexitHandlerInitialized) {
// EGL registers atexit handlers to cleanup its global display list.
@@ -218,13 +219,9 @@
// EGL atexit handlers and the PlatformDisplay destructor.
// See https://bugs.webkit.org/show_bug.cgi?id=157973.
eglAtexitHandlerInitialized = true;
- std::atexit([] {
- while (!eglDisplays().isEmpty()) {
- auto* display = eglDisplays().takeAny();
- display->terminateEGLDisplay();
- }
- });
+ std::atexit(shutDownEglDisplays);
}
+#endif
}
void PlatformDisplay::terminateEGLDisplay()
@@ -236,6 +233,15 @@
eglTerminate(m_eglDisplay);
m_eglDisplay = EGL_NO_DISPLAY;
}
+
+void PlatformDisplay::shutDownEglDisplays()
+{
+ while (!eglDisplays().isEmpty()) {
+ auto* display = eglDisplays().takeAny();
+ display->terminateEGLDisplay();
+ }
+}
+
#endif // USE(EGL)
} // namespace WebCore
Modified: trunk/Source/WebCore/platform/graphics/PlatformDisplay.h (214687 => 214688)
--- trunk/Source/WebCore/platform/graphics/PlatformDisplay.h 2017-03-31 21:46:42 UTC (rev 214687)
+++ trunk/Source/WebCore/platform/graphics/PlatformDisplay.h 2017-03-31 22:03:39 UTC (rev 214688)
@@ -65,6 +65,7 @@
#if USE(EGL)
EGLDisplay eglDisplay() const;
bool eglCheckVersion(int major, int minor) const;
+ static void shutDownEglDisplays();
#endif
protected:
Modified: trunk/Source/WebKit/win/ChangeLog (214687 => 214688)
--- trunk/Source/WebKit/win/ChangeLog 2017-03-31 21:46:42 UTC (rev 214687)
+++ trunk/Source/WebKit/win/ChangeLog 2017-03-31 22:03:39 UTC (rev 214688)
@@ -1,3 +1,13 @@
+2017-03-31 Fujii Hironori <[email protected]>
+
+ [WinCairo] WebCore::PlatformDisplay::terminateEGLDisplay causes a crash in libGLESv2.dll while processing atexit
+ https://bugs.webkit.org/show_bug.cgi?id=170331
+
+ Reviewed by Michael Catanzaro.
+
+ * WebKitDLL.cpp:
+ (shutDownWebKit): Call PlatformDisplay::shutDownEglDisplays in shutDownWebKit.
+
2017-03-30 James Craig <[email protected]>
AX: Expose a new AXSubrole for explicit ARIA "group" role
Modified: trunk/Source/WebKit/win/WebKitDLL.cpp (214687 => 214688)
--- trunk/Source/WebKit/win/WebKitDLL.cpp 2017-03-31 21:46:42 UTC (rev 214687)
+++ trunk/Source/WebKit/win/WebKitDLL.cpp 2017-03-31 22:03:39 UTC (rev 214688)
@@ -39,6 +39,7 @@
#include <WebCore/IconDatabase.h>
#include <WebCore/Page.h>
#include <WebCore/PageGroup.h>
+#include <WebCore/PlatformDisplay.h>
#include <WebCore/RenderThemeWin.h>
#include <WebCore/SharedBuffer.h>
#include <WebCore/WebCoreInstanceHandle.h>
@@ -164,6 +165,9 @@
{
WebCore::iconDatabase().close();
WebKit::WebStorageNamespaceProvider::closeLocalStorage();
+#if USE(EGL)
+ PlatformDisplay::shutDownEglDisplays();
+#endif
}
//FIXME: We should consider moving this to a new file for cross-project functionality
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes