From 6f71d1a22592c08a9b51fc72683d08abfd3a01e8 Mon Sep 17 00:00:00 2001 From: Jeremy Rose Date: Tue, 27 Jul 2021 10:35:16 -0700 Subject: [PATCH] test fix for (unrelated) bug showing up on linux-asan (cherry picked from commit a65d2dacd3b2bfdd9473dc892a161c95a1f5da58) --- patches/config.json | 2 ++ patches/webrtc/.patches | 1 + .../add_thread_local_to_x_error_trap_cc.patch | 24 +++++++++++++++++++ 3 files changed, 27 insertions(+) create mode 100644 patches/webrtc/.patches create mode 100644 patches/webrtc/add_thread_local_to_x_error_trap_cc.patch diff --git a/patches/config.json b/patches/config.json index b0156f7d1c057..e9a2297ba10f2 100644 --- a/patches/config.json +++ b/patches/config.json @@ -3,6 +3,8 @@ "src/electron/patches/boringssl": "src/third_party/boringssl/src", + "src/electron/patches/webrtc": "src/third_party/webrtc", + "src/electron/patches/v8": "src/v8", "src/electron/patches/node": "src/third_party/electron_node", diff --git a/patches/webrtc/.patches b/patches/webrtc/.patches new file mode 100644 index 0000000000000..9cde1db8895b3 --- /dev/null +++ b/patches/webrtc/.patches @@ -0,0 +1 @@ +add_thread_local_to_x_error_trap_cc.patch diff --git a/patches/webrtc/add_thread_local_to_x_error_trap_cc.patch b/patches/webrtc/add_thread_local_to_x_error_trap_cc.patch new file mode 100644 index 0000000000000..0be67e3ccafd1 --- /dev/null +++ b/patches/webrtc/add_thread_local_to_x_error_trap_cc.patch @@ -0,0 +1,24 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Jeremy Rose +Date: Tue, 27 Jul 2021 10:32:54 -0700 +Subject: add thread_local to x_error_trap.cc + +Per https://bugs.chromium.org/p/chromium/issues/detail?id=781618#c6. + +To fix this DCHECK firing: https://source.chromium.org/chromium/chromium/src/+/main:third_party/webrtc/modules/desktop_capture/linux/x_error_trap.cc;l=35;drc=25ab3228f3e473f2226f219531ec617d2daa175e + +diff --git a/modules/desktop_capture/linux/x_error_trap.cc b/modules/desktop_capture/linux/x_error_trap.cc +index 13233d827470d9d42be0333c3080e3d107f86fd5..62efb5b5b5194fc8961a27fe2a1efcd77e385d08 100644 +--- a/modules/desktop_capture/linux/x_error_trap.cc ++++ b/modules/desktop_capture/linux/x_error_trap.cc +@@ -19,8 +19,8 @@ namespace webrtc { + namespace { + + // TODO(sergeyu): This code is not thread safe. Fix it. Bug 2202. +-static bool g_xserver_error_trap_enabled = false; +-static int g_last_xserver_error_code = 0; ++static thread_local bool g_xserver_error_trap_enabled = false; ++static thread_local int g_last_xserver_error_code = 0; + + int XServerErrorHandler(Display* display, XErrorEvent* error_event) { + RTC_DCHECK(g_xserver_error_trap_enabled);