From 02ea88f79f5ed67e89e97d3b2149c66c38e8984b Mon Sep 17 00:00:00 2001 From: Marshall Greenblatt Date: Mon, 15 Jul 2024 15:13:42 -0400 Subject: [PATCH] Call SetIsShutdown after CefInitialize (fixes #3738) Delay shutdown checking until after CefInitialize has drained existing task pools. --- libcef_dll/libcef_dll.cc | 8 ++++---- libcef_dll/wrapper/libcef_dll_wrapper.cc | 8 ++++---- tools/make_cpptoc_impl.py | 10 +++++----- tools/make_ctocpp_impl.py | 10 +++++----- 4 files changed, 18 insertions(+), 18 deletions(-) diff --git a/libcef_dll/libcef_dll.cc b/libcef_dll/libcef_dll.cc index 7b3886534..7f3ef9708 100644 --- a/libcef_dll/libcef_dll.cc +++ b/libcef_dll/libcef_dll.cc @@ -9,7 +9,7 @@ // implementations. See the translator.README.txt file in the tools directory // for more information. // -// $hash=bc230d77e2985959bc5a6a2af80b500eec070384$ +// $hash=4a4490df4b9440aeb853d6625fddb7de5741f5b0$ // #include "include/capi/cef_app_capi.h" @@ -131,12 +131,12 @@ CEF_EXPORT int cef_get_exit_code() { CEF_EXPORT void cef_shutdown() { // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + // Execute + CefShutdown(); + #if DCHECK_IS_ON() shutdown_checker::SetIsShutdown(); #endif - - // Execute - CefShutdown(); } CEF_EXPORT void cef_do_message_loop_work() { diff --git a/libcef_dll/wrapper/libcef_dll_wrapper.cc b/libcef_dll/wrapper/libcef_dll_wrapper.cc index 0c5906121..93cde65b3 100644 --- a/libcef_dll/wrapper/libcef_dll_wrapper.cc +++ b/libcef_dll/wrapper/libcef_dll_wrapper.cc @@ -9,7 +9,7 @@ // implementations. See the translator.README.txt file in the tools directory // for more information. // -// $hash=16d4e51ecbe1fd8eb6915d951a84f707f73dfb1a$ +// $hash=e9099c29c9695cabcedfde25b85c1f77f14cb516$ // #include "include/capi/cef_app_capi.h" @@ -119,12 +119,12 @@ NO_SANITIZE("cfi-icall") CEF_GLOBAL int CefGetExitCode() { NO_SANITIZE("cfi-icall") CEF_GLOBAL void CefShutdown() { // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + // Execute + cef_shutdown(); + #if DCHECK_IS_ON() shutdown_checker::SetIsShutdown(); #endif - - // Execute - cef_shutdown(); } NO_SANITIZE("cfi-icall") CEF_GLOBAL void CefDoMessageLoopWork() { diff --git a/tools/make_cpptoc_impl.py b/tools/make_cpptoc_impl.py index 2645447d0..4ae23faf9 100644 --- a/tools/make_cpptoc_impl.py +++ b/tools/make_cpptoc_impl.py @@ -320,11 +320,6 @@ def make_cpptoc_function_impl_new(cls, name, func, defined_names, base_scoped): result += '\n' result_len = len(result) - if is_cef_shutdown: - result += '\n\n#if DCHECK_IS_ON()'\ - '\n shutdown_checker::SetIsShutdown();'\ - '\n#endif\n' - # execution result += '\n // Execute\n ' @@ -355,6 +350,11 @@ def make_cpptoc_function_impl_new(cls, name, func, defined_names, base_scoped): result += ');\n' + if is_cef_shutdown: + result += '\n\n#if DCHECK_IS_ON()'\ + '\n shutdown_checker::SetIsShutdown();'\ + '\n#endif\n' + result_len = len(result) # parameter restoration diff --git a/tools/make_ctocpp_impl.py b/tools/make_ctocpp_impl.py index 07c4cf856..374923e4c 100644 --- a/tools/make_ctocpp_impl.py +++ b/tools/make_ctocpp_impl.py @@ -335,11 +335,6 @@ def make_ctocpp_function_impl_new(clsname, name, func, base_scoped): result += '\n' result_len = len(result) - if is_cef_shutdown: - result += '\n\n#if DCHECK_IS_ON()'\ - '\n shutdown_checker::SetIsShutdown();'\ - '\n#endif\n' - # execution result += '\n // Execute\n ' @@ -369,6 +364,11 @@ def make_ctocpp_function_impl_new(clsname, name, func, base_scoped): result += ');\n' + if is_cef_shutdown: + result += '\n\n#if DCHECK_IS_ON()'\ + '\n shutdown_checker::SetIsShutdown();'\ + '\n#endif\n' + result_len = len(result) # parameter restoration