Title: [265003] trunk/Source/WebCore
Revision
265003
Author
hironori.fu...@sony.com
Date
2020-07-28 13:22:03 -0700 (Tue, 28 Jul 2020)

Log Message

[WinCairo] ANGLE D3D renderer can crash when PlatformDisplayWin is destructed in IPC thread
https://bugs.webkit.org/show_bug.cgi?id=214241

Reviewed by Don Olmstead.

Web process calls _exit() in IPC thread when the IPC connection is
closed. PlatformDisplay::sharedDisplay has a static variable of
std::unique_ptr<PlatformDisplay> to ensure it will be destructed
on the process termination. This rarely causes crashes in ANGLE
because ANGLE D3D renderer isn't thread-safe at the moment.

* platform/graphics/PlatformDisplay.cpp:
(WebCore::PlatformDisplay::sharedDisplay): Don't destruct
PlatformDisplay for PLATFORM(WIN). Use unique_ptr::release to leak it.

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (265002 => 265003)


--- trunk/Source/WebCore/ChangeLog	2020-07-28 20:14:31 UTC (rev 265002)
+++ trunk/Source/WebCore/ChangeLog	2020-07-28 20:22:03 UTC (rev 265003)
@@ -1,3 +1,20 @@
+2020-07-28  Fujii Hironori  <hironori.fu...@sony.com>
+
+        [WinCairo] ANGLE D3D renderer can crash when PlatformDisplayWin is destructed in IPC thread
+        https://bugs.webkit.org/show_bug.cgi?id=214241
+
+        Reviewed by Don Olmstead.
+
+        Web process calls _exit() in IPC thread when the IPC connection is
+        closed. PlatformDisplay::sharedDisplay has a static variable of
+        std::unique_ptr<PlatformDisplay> to ensure it will be destructed
+        on the process termination. This rarely causes crashes in ANGLE
+        because ANGLE D3D renderer isn't thread-safe at the moment.
+
+        * platform/graphics/PlatformDisplay.cpp:
+        (WebCore::PlatformDisplay::sharedDisplay): Don't destruct
+        PlatformDisplay for PLATFORM(WIN). Use unique_ptr::release to leak it.
+
 2020-07-28  Clark Wang  <clark_w...@apple.com>
 
         Added constructor methods to ChannelMergerNode, ChannelSplitterNode

Modified: trunk/Source/WebCore/platform/graphics/PlatformDisplay.cpp (265002 => 265003)


--- trunk/Source/WebCore/platform/graphics/PlatformDisplay.cpp	2020-07-28 20:14:31 UTC (rev 265002)
+++ trunk/Source/WebCore/platform/graphics/PlatformDisplay.cpp	2020-07-28 20:22:03 UTC (rev 265003)
@@ -126,6 +126,12 @@
 
 PlatformDisplay& PlatformDisplay::sharedDisplay()
 {
+#if PLATFORM(WIN)
+    // ANGLE D3D renderer isn't thread-safe. Don't destruct it on non-main threads which calls _exit().
+    ASSERT(isMainThread());
+    static PlatformDisplay* display = createPlatformDisplay().release();
+    return *display;
+#else
     static std::once_flag onceFlag;
     IGNORE_CLANG_WARNINGS_BEGIN("exit-time-destructors")
     static std::unique_ptr<PlatformDisplay> display;
@@ -134,6 +140,7 @@
         display = createPlatformDisplay();
     });
     return *display;
+#endif
 }
 
 static PlatformDisplay* s_sharedDisplayForCompositing;
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to