Crash in CefExecuteProcess when CefExecuteProcess not called

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.

Crash in CefExecuteProcess when CefExecuteProcess not called

Postby Arno70 » Wed Dec 28, 2016 10:57 am

I am trying to embedd CEF into an C++ based windows application (Windows 7, 64Bit, cef_binary_3.2883.1540.gedbfb20_windows64). When i build the sample application cefsimple it runs nicely, I also created my own app simialr to it, also works nicely. However all these assume that CEF is running as the main window. I want to embed it as a child into my application (possibly several instances).

I also read the nice article https://www.codeproject.com/Articles/1105945/Embedding-a-Chromium-browser-in-an-MFC-application.

The issue I am facing whenever I do not call CefExecuteProcess during initialization, is that CefInitialize crashes.

If I call it I get it the CEFs windows and processes and my own collide. The article mentioned above also does not call CefExecuteProcess and it seems to work. Any ideas on what I am doing wrong?
Arno70
Newbie
 
Posts: 4
Joined: Wed Dec 28, 2016 8:59 am

Re: Crash in CefExecuteProcess when CefExecuteProcess not ca

Postby ScottV » Wed Dec 28, 2016 3:04 pm

Take a look at this example:
https://bitbucket.org/TSS_DEV/cef-mfc

The example uses "multi_threaded_message_loop = FALSE;" and uses the MFC "PumpMessage()" to run "CefDoMessageLoopWork()".

--Scott
ScottV
Techie
 
Posts: 27
Joined: Thu Mar 27, 2014 1:22 pm

Re: Crash in CefExecuteProcess when CefExecuteProcess not ca

Postby amaitland » Wed Dec 28, 2016 4:12 pm

Maintainer of the CefSharp project.
amaitland
Virtuoso
 
Posts: 1292
Joined: Wed Jan 14, 2015 2:35 am

Re: Crash in CefExecuteProcess when CefExecuteProcess not ca

Postby Arno70 » Thu Dec 29, 2016 6:25 am

Thanks a lot for your replay. My core application is up and running now.

The issue was that I was that I missed the return check in the CefExecuteProcess call.

Now my code looks like this (based on the MFC sample you provided)

Code: Select all
      // Initialize CEF
      CefRefPtr<BrowserApp>   cef_app = new BrowserApp();

      CefMainArgs main_args(hInstance);
      int exit_code = CefExecuteProcess(main_args, cef_app, nullptr);
      if (exit_code >= 0) {
         return exit_code;
      }

      CefSettings settings;
      settings.multi_threaded_message_loop = false;

      CefInitialize(main_args, settings, cef_app, nullptr);

      // all my application startup, message loop and shutdown code code

      // shut down CEFS
      cef_app = nullptr;
      CefShutdown();


This is starting and shutting down smoothly. I am also calling CefDoMessageLoopWork() in a timer callback every 10ms and it seems to work without any noticeable CPU load.

So I am ready to add some browsers to child windows!

Thanks again for you support!
Arno70
Newbie
 
Posts: 4
Joined: Wed Dec 28, 2016 8:59 am


Return to Support Forum

Who is online

Users browsing this forum: No registered users and 37 guests