From 3338bed393a3acc3973535bef42b6964f8d41ff2 Mon Sep 17 00:00:00 2001 From: Takagi Tasuku Date: Mon, 2 Feb 2026 19:11:41 +0900 Subject: [PATCH] fix: initialize CEF API version in cefsimple macOS helper On macOS, CEF requires calling `cef_api_hash` immediately after `cef_load_library` in both the main process and helper processes. This initialization is necessary to ensure that CEF functions are correctly configured and available before any other API calls. Without this, calling CEF APIs such as `args.as_cmd_line()` which invokes `cef_command_line_create` before `execute_process` results in undefined behavior or crashes. This patch aligns the cef-rs' cefsimple macOS helper with the official CEF C API implementation. References: - https://chromiumembedded.github.io/cef/using_the_capi#api-version-initialization - https://github.com/chromiumembedded/cef/blob/5f93c2b090d19659451de4dfe44896ad7dbfd832/tests/cefsimple_capi/cefsimple_mac.m#L105-L107 --- examples/cefsimple/src/bin/cefsimple_helper.rs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/examples/cefsimple/src/bin/cefsimple_helper.rs b/examples/cefsimple/src/bin/cefsimple_helper.rs index 5dbab0a..891ec40 100644 --- a/examples/cefsimple/src/bin/cefsimple_helper.rs +++ b/examples/cefsimple/src/bin/cefsimple_helper.rs @@ -17,6 +17,9 @@ fn main() { loader }; + // Initialize the CEF API version. + let _ = api_hash(sys::CEF_API_VERSION_LAST, 0); + execute_process( Some(args.as_main_args()), None::<&mut App>,