Check failed: !IsCefShutDown()

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.

Check failed: !IsCefShutDown()

Postby jokercc » Mon Jan 04, 2021 9:40 pm

The function 'OnBeforeClose' is never called before 'CefShutDown' called, even if it sleeps for 60 seconds.The
Error message: [0105/101754.905:FATAL:shutdown_checker.cc(52)] Check failed: !IsCefShutdown(). Object reference incorrectly held at CefShutdown
call stack:
libcef.dll!logging::LogMessage::~LogMessage() Line 873 C++
libcef.dll!logging::LogMessage::~LogMessage() Line 549 C++
libcef.dll!logging::CheckError::~CheckError() Line 105 C++
> libcef.dll!shutdown_checker::AssertNotShutdown() Line 54 C++
libcef.dll!CefLifeSpanHandlerCToCpp::OnBeforeClose(scoped_refptr<CefBrowser> browser) Line 150 C++
libcef.dll!CefBrowserHostBase::OnBeforeClose() Line 763 C++
libcef.dll!AlloyBrowserHostImpl::DestroyBrowser() Line 840 C++
libcef.dll!CefBrowserInfoManager::DestroyAllBrowsers() Line 347 C++
libcef.dll!CefContext::ShutdownOnUIThread() Line 484 C++
libcef.dll!base::OnceCallback<void ()>::Run() Line 100 C++
libcef.dll!CefMainRunner::FinishShutdownOnUIThread(base::OnceCallback<void ()> shutdown_on_ui_thread, base::WaitableEvent * uithread_shutdown_event) Line 486 C++
jokercc
Newbie
 
Posts: 4
Joined: Wed Dec 30, 2020 2:40 am

Re: Check failed: !IsCefShutDown()

Postby rjxray » Fri Jan 15, 2021 4:02 am

Are you calling CefDoMessageLoopWork() ?
see viewtopic.php?f=6&t=17669&start=10
rjxray
Mentor
 
Posts: 51
Joined: Wed Jun 07, 2017 4:31 am

Re: Check failed: !IsCefShutDown()

Postby jokercc » Mon Apr 12, 2021 4:02 am

No, the application is created with a CefSettings.multi_threaded_message_loop value of true.
Actually, the browser is neither destroyed when I called CloseBrowser(true/false) nor after the parent window destroyed.Should I notify the window destruction ?
Part of the code as follows:
BOOL CMainDlg::OnInitDialog(HWND hWnd, LPARAM lp)
{
// create cef window
CefWindowInfo info;
SOUI::CRect rcWnd = GetClientRect();
rcWnd.DeflateRect(10, 30, 10, 10);
info.SetAsChild(m_hWnd, rcWnd);
CefRefPtr<ClientHandler> client_hander = new ClientHandler(false);
CefString url = "https://magpcss.org/ceforum/index.php";
CefBrowserSettings bsr_settings;
CefBrowserHost::CreateBrowser(info, client_hander.get(), url, bsr_settings, NULL, NULL);
client_hander->SetParentHwnd(m_hWnd);
m_bLayoutInited = true;
return TRUE;
}
jokercc
Newbie
 
Posts: 4
Joined: Wed Dec 30, 2020 2:40 am

Re: Check failed: !IsCefShutDown()

Postby rado » Mon Apr 12, 2021 9:57 am

Check my post https://magpcss.org/ceforum/viewtopic.php?f=6&t=15518#p48696
Sleep is useless, you need to keep processing window messages while waiting for OnBeforeClose that's why I won't destroy main application window until browser is destroyed.
rado
Expert
 
Posts: 109
Joined: Wed Oct 05, 2011 3:32 am

Re: Check failed: !IsCefShutDown()

Postby jokercc » Tue Apr 13, 2021 10:04 pm

Thanks! I used a hidden window to quit the main message loop after OnBeforeClose called.
jokercc
Newbie
 
Posts: 4
Joined: Wed Dec 30, 2020 2:40 am


Return to Support Forum

Who is online

Users browsing this forum: No registered users and 21 guests