[Windows]: Crash in CefExecuteProcess (Releated to scoped_re

Having problems with building or using CEF's C/C++ APIs? This forum is here to help. Please do not post bug reports or feature requests here.

[Windows]: Crash in CefExecuteProcess (Releated to scoped_re

Postby govind » Fri Aug 19, 2022 12:38 am

Hi, I am building CEF branch 4844 with below args in windows:

Code: Select all
chrome_pgo_phase=0
clang_use_chrome_plugins=false
enable_background_mode=false
enable_basic_printing=true
enable_nacl=false
enable_print_preview=true
enable_resource_allowlist_generation=false
enable_widevine=true
is_component_build=false
is_debug=false
optimize_webui=true
target_cpu="x64"
use_debug_fission=true
ffmpeg_branding="Chrome"
proprietary_codecs=true
use_allocator_shim=false
use_allocator="none"
adobe_lib_runtime=true
is_official_build=true
use_thin_lto=false


While trying to integrate above CEF build in windows, I am experiencing a crash when calling CefExecuteProcess and I can't figure out the reason by myself.

Code to Reproduce:

Code: Select all
CefMainArgs main_args(hInstance);
CefRefPtr<ClientApp> cefApp(new ClientApp());
int exit_code = CefExecuteProcess(main_args, cefApp.get(), NULL);
if (exit_code >= 0)
{
    return exit_code;
}

I am using Visual Studio 2019 and C++ 17 to

My ClientApp looks like below and implement CefApp, CefBrowserProcessHandler and CefRenderProcessHandler methods:
Code: Select all
class ClientApp : public CefApp, public CefBrowserProcessHandler,public CefRenderProcessHandler


In this situation I expect CefExecuteProcess() to either succeed or return a non-zero code. However in practice it crashes with Access violation reading location error.

While debugging, I can see CefApp address pointer what I am passing in CefExecuteProcess is getting changed inside libcef_dll_wrapper.cc.
Call stack looks like below:

Code: Select all
[Inline Frame] CEPHtmlEngine.exe!scoped_refptr<CefApp>::AddRef(CefApp * ptr) Line 350   
[Inline Frame] CEPHtmlEngine.exe!scoped_refptr<CefApp>::scoped_refptr(CefApp * p) Line 226 
[Inline Frame] CEPHtmlEngine.exe!scoped_refptr<CefApp>::scoped_refptr(const scoped_refptr<CefApp> & r) Line 231
CEPHtmlEngine.exe!CefExecuteProcess(const CefMainArgs & args, scoped_refptr<CefApp> application, void * windows_sandbox_info) Line 82
CEPHtmlEngine.exe!wWinMain(HINSTANCE__ * hInstance, HINSTANCE__ * hPrevInstance, wchar_t * lpCmdLine, int nCmdShow) Line 300

I’ve spent a lot of time on this, and I don’t think this is a bug in CEF, but rather me using it incorrectly or building CEF incorrectly. However I have no clue about where to go now, so I’m seeking for your advice, hoping you’re seeing something I’m not.
govind
Newbie
 
Posts: 2
Joined: Fri Jul 29, 2022 3:07 am

Re: [Windows]: Crash in CefExecuteProcess (Releated to scope

Postby magreenblatt » Fri Aug 19, 2022 7:13 am

Are you building using CEF binary distribution? Did you compile libcef_dll_wrapper code with the same configuration (compiler defines, linker flags, etc) as your application?
magreenblatt
Site Admin
 
Posts: 12383
Joined: Fri May 29, 2009 6:57 pm

Re: [Windows]: Crash in CefExecuteProcess (Releated to scope

Postby govind » Mon Aug 22, 2022 12:35 am

For better understanding, I am upgrading CEF from 88 version to 99. I am compiling CEF with clang and integrating it in my application which is compiled with msvc and same process was being used in previous integration as well.

I am using same linker flags and compiler defines which were being used with CEF version 88.

I am setting below environment variable while creating CEF project.

Code: Select all
set DEPOT_TOOLS_WIN_TOOLCHAIN=0
set GYP_MSVS_VERSION=2019
set GN_DEFINES=is_component_build=false is_debug=false use_debug_fission=true is_official_build=true use_thin_lto=false
set GN_ARGUMENTS=--ide=vs2019 --sln=cef --filters=//cef/*
govind
Newbie
 
Posts: 2
Joined: Fri Jul 29, 2022 3:07 am


Return to Support Forum

Who is online

Users browsing this forum: No registered users and 36 guests