Break point hit during shutdown

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.

Break point hit during shutdown

Postby atp15 » Thu Nov 24, 2016 6:23 am

My MFC application is hitting a breakpoint when I close it related to CefShutdown(). Cef is inside a DLL project CefEmbed which is used by the main application. I'm using multi_threaded_message_loop set to false. I'm using CEF 3.2704.1434.


Here is the call stack:
Code: Select all
 
libcef.dll!base::debug::BreakDebugger()  Line 21   
libcef.dll!logging::LogMessage::~LogMessage()  Line 738   
libcef.dll!CefBrowserMainParts::PostMainMessageLoopRun()  Line 186   
libcef.dll!content::BrowserMainLoop::ShutdownThreadsAndCleanUp()  Line 977 + 0x27 bytes   
libcef.dll!content::BrowserMainRunnerImpl::Shutdown()  Line 212   
libcef.dll!CefMainDelegate::ShutdownBrowser()  Line 661 + 0x1b bytes   
libcef.dll!CefContext::FinalizeShutdown()  Line 466   
libcef.dll!CefContext::Shutdown()  Line 347   
libcef.dll!CefShutdown()  Line 172   
libcef.dll!cef_shutdown()  Line 216   
>CefEmbed.dll!CefShutdown()  Line 204 + 0x8 bytes   C++
 CefEmbed.dll!CCefEmbedApp::UninitializeCef()  Line 74   C++


Here is my is my code to initialise CEF.

Code: Select all
bool CCefEmbedApp::InitializeCef()
{
   if (!m_bCefInitialized)
   {
      HINSTANCE hInstance = GetModuleHandle(NULL);
      CefMainArgs mainArgs(hInstance);

      CefSettings settings;
      settings.no_sandbox = true;
      settings.multi_threaded_message_loop = false;
      settings.single_process = true;

      CefRefPtr<MyCefApp> cefApp = new MyCefApp();
      m_bCefInitialized = CefInitialize(mainArgs, settings, cefApp.get(), NULL);

      return m_bCefInitialized;
   }

   return false;
}


To unitialise CEF I used the following.

Code: Select all
void CCefEmbedApp::UninitializeCef()
{
   if (m_bCefInitialized)
   {
      m_bCefInitialized = false;

      for (int i = 0; i < 10; i++)
      {
         CefDoMessageLoopWork();
      }

      CefShutdown();
   }
}


I'm running the message loop by having PumpMessage in the main application call a function inside the DLL.
Code: Select all
void CCefEmbedApp::DoMessageLoopWork()
{
   if (m_bCefInitialized)
   {
      CefDoMessageLoopWork();
   }
}


Thanks
atp15
Techie
 
Posts: 22
Joined: Thu Nov 17, 2016 5:25 am

Re: Break point hit during shutdown

Postby amaitland » Thu Nov 24, 2016 7:30 am

1. Single process mode isn't supported, it's only for internal debugging, not for production use.
2. Are you using a Debug build? If so switch to a Release build and see if that resolves your problem. Similar questions have been asked like viewtopic.php?f=6&t=13741
3. Make sure you've released all your CefRequestContext objects (if your using them)
4. Make sure you call CefShutdown on the same thread as CefInitialize
5. Consider upgrading to a supported version 2704 is quite out of date now.

https://bitbucket.org/chromiumembedded/ ... -supported
Maintainer of the CefSharp project.
amaitland
Virtuoso
 
Posts: 1290
Joined: Wed Jan 14, 2015 2:35 am

Re: Break point hit during shutdown

Postby digory » Thu Nov 24, 2016 10:49 am

The crash may be due to this bug: https://bitbucket.org/chromiumembedded/cef/issues/1680/windows-2454-crash-on-shutdown-with-multi. If it is the same, please upvote the issue.
digory
Expert
 
Posts: 118
Joined: Wed Oct 26, 2016 3:13 am

Re: Break point hit during shutdown

Postby amaitland » Thu Nov 24, 2016 4:34 pm

digory wrote:The crash may be due to this bug: https://bitbucket.org/chromiumembedded/cef/issues/1680/windows-2454-crash-on-shutdown-with-multi. If it is the same, please upvote the issue.


User states multi_threaded_message_loop = false
Maintainer of the CefSharp project.
amaitland
Virtuoso
 
Posts: 1290
Joined: Wed Jan 14, 2015 2:35 am


Return to Support Forum

Who is online

Users browsing this forum: Google [Bot] and 22 guests