Windows: Disable iterator debugging for cef_sandbox builds (fixes issue #3109)

Iterator debugging has been disabled by default (_HAS_ITERATOR_DEBUGGING=0)
for CEF/Chromium builds using clang/LLVM since 2018. Inversely, it is enabled
by default (_ITERATOR_DEBUG_LEVEL=2) for the MSVC Debug build configuration.
In order to minimize configuration-related headaches for MSVC-based clients
we have been building the Debug cef_sandbox.lib with iterator debugging
enabled. Recently, we have identified a number of crashes that may be due to
bugs in current clang/LLVM or MSVC versions but in any case can be resolved by
disabling iterator debugging:

- Crash when loading chrome://sandbox.
- Crash if an application lists libraries that utilize iterators after
  cef_sandbox.lib in the linker order.

To resolve these crashes we will now disable iterator debugging by default
for the cef_sandbox.lib builds. Client applications that link cef_sandbox.lib
will now also need to build with iterator debugging disabled by setting
_HAS_ITERATOR_DEBUGGING=0 or _ITERATOR_DEBUG_LEVEL=0 in their project
configuration (this will be done for you if you use cef_variables.cmake from
the binary distribution).

In addition to the crash fixes mentioned above, this change also:

- Reduces the size of the Debug cef_sandbox.lib by ~10MB.
- May result in faster Debug executables (see https://crbug.com/539996).
This commit is contained in:
Marshall Greenblatt 2021-04-26 16:55:55 -04:00
parent 511e10d594
commit 328de502ac
2 changed files with 3 additions and 4 deletions

View File

@ -491,6 +491,9 @@ if(OS_WINDOWS)
PSAPI_VERSION=1 # Required by cef_sandbox.lib
CEF_USE_SANDBOX # Used by apps to test if the sandbox is enabled
)
list(APPEND CEF_COMPILER_DEFINES_DEBUG
_HAS_ITERATOR_DEBUGGING=0 # Disable iterator debugging
)
# Libraries required by cef_sandbox.lib.
set(CEF_SANDBOX_STANDARD_LIBS

View File

@ -480,10 +480,6 @@ def GetConfigArgsSandbox(platform, args, is_debug, cpu):
'is_cef_sandbox_build': True,
}
if is_debug:
# Enable iterator debugging (_ITERATOR_DEBUG_LEVEL=2).
add_args['enable_iterator_debugging'] = True
if platform == 'windows':
# Avoid Debug build linker errors caused by custom libc++.
add_args['use_custom_libcxx'] = False