Here is the stack trace:
- Code: Select all
Shadow.exe!scoped_refptr<CefFrame>::~scoped_refptr<CefFrame>() Line 323 C++ Symbols loaded.
> Shadow.exe!CefLifeSpanHandler::OnBeforePopup(scoped_refptr<CefBrowser> browser, scoped_refptr<CefFrame> frame, const CefStringBase<CefStringTraitsUTF16> & target_url, const CefStringBase<CefStringTraitsUTF16> & target_frame_name, cef_window_open_disposition_t target_disposition, bool user_gesture, const CefStructBase<CefPopupFeaturesTraits> & popupFeatures, CefWindowInfo & windowInfo, scoped_refptr<CefClient> & client, CefStructBase<CefBrowserSettingsTraits> & settings, bool * no_javascript_access) Line 90 C++ Symbols loaded.
Shadow.exe!`anonymous namespace'::load_handler_on_loading_state_change(_cef_load_handler_t * self, _cef_browser_t * browser, int isLoading, int canGoBack, int canGoForward) Line 40 C++ Symbols loaded.
libcef.dll!CefLoadHandlerCToCpp::OnLoadingStateChange(scoped_refptr<CefBrowser>) Line 37 C++ Symbols loaded.
libcef.dll!CefBrowserHostImpl::LoadingStateChanged(content::WebContents * source, bool to_different_document) Line 2218 C++ Symbols loaded.
libcef.dll!content::WebContentsImpl::LoadingStateChanged(bool to_different_document, bool due_to_interstitial, content::LoadNotificationDetails * details) Line 4522 C++ Symbols loaded.
libcef.dll!content::WebContentsImpl::DidStartLoading(content::FrameTreeNode * frame_tree_node, bool) Line 5087 C++ Symbols loaded.
libcef.dll!content::FrameTreeNode::DidStartLoading(bool to_different_document, bool was_previously_loading) Line 558 C++ Symbols loaded.
libcef.dll!content::FrameTreeNode::CreatedNavigationRequest(std::unique_ptr<content::NavigationRequest,std::default_delete<content::NavigationRequest> > navigation_request) Line 498 C++ Symbols loaded.
libcef.dll!content::NavigatorImpl::RequestNavigation(content::FrameTreeNode * frame_tree_node, const GURL & navigation_start, const content::Referrer &) Line 1071 C++ Symbols loaded.
libcef.dll!content::NavigatorImpl::NavigateToEntry(content::FrameTreeNode * frame_tree_node, const content::FrameNavigationEntry &) Line 338 C++ Symbols loaded.
libcef.dll!content::NavigatorImpl::NavigateToPendingEntry(content::FrameTreeNode * frame_entry, const content::FrameNavigationEntry & reload_type, content::ReloadType is_same_document_history_load, bool navigation_ui_data, std::unique_ptr<content::NavigationUIData,std::default_delete<content::NavigationUIData> >) Line 387 C++ Symbols loaded.
libcef.dll!content::NavigationControllerImpl::NavigateToPendingEntryInternal(content::ReloadType reload_type, std::unique_ptr<content::NavigationUIData,std::default_delete<content::NavigationUIData> >) Line 2157 C++ Symbols loaded.
libcef.dll!content::NavigationControllerImpl::NavigateToPendingEntry(content::ReloadType reload_type, std::unique_ptr<content::NavigationUIData,std::default_delete<content::NavigationUIData> >) Line 2111 C++ Symbols loaded.
libcef.dll!content::NavigationControllerImpl::LoadEntry(std::unique_ptr<content::NavigationEntryImpl,std::default_delete<content::NavigationEntryImpl> > navigation_ui_data, std::unique_ptr<content::NavigationUIData,std::default_delete<content::NavigationUIData> >) Line 512 C++ Symbols loaded.
libcef.dll!content::NavigationControllerImpl::LoadURLWithParams(const content::NavigationController::LoadURLParams & params) Line 870 C++ Symbols loaded.
libcef.dll!content::NavigationControllerImpl::LoadURL(const GURL & url, const content::Referrer & referrer, ui::PageTransition transition, const std::basic_string<char,std::char_traits<char>,std::allocator<char> > & extra_headers) Line 722 C++ Symbols loaded.
libcef.dll!CefBrowserHostImpl::LoadURL(__int64 frame_id, const std::basic_string<char,std::char_traits<char>,std::allocator<char> > & url, const content::Referrer & referrer, ui::PageTransition transition, const std::basic_string<char,std::char_traits<char>,std::allocator<char> > & extra_headers) Line 1670 C++ Symbols loaded.
libcef.dll!CefBrowserHostImpl::Create(CefBrowserHostImpl::CreateParams & create_params) Line 372 C++ Symbols loaded.
libcef.dll!CefBrowserHost::CreateBrowserSync(const CefWindowInfo & client, scoped_refptr<CefClient>) Line 274 C++ Symbols loaded.
libcef.dll!`anonymous namespace'::CreateBrowserWithHelper(`anonymous namespace'::CreateBrowserHelper * helper) Line 142 C++ Symbols loaded.
[Inline Frame] libcef.dll!base::internal::FunctorTraits<void (*)(blink::WaitableEvent *),void>::Invoke(void(*)(blink::WaitableEvent *)) Line 402 C++ Symbols loaded.
[Inline Frame] libcef.dll!base::internal::InvokeHelper<0,void>::MakeItSo(void(*)(blink::WaitableEvent *) &) Line 530 C++ Symbols loaded.
[Inline Frame] libcef.dll!base::internal::Invoker<base::internal::BindState<void (*)(blink::WaitableEvent *),WTF::CrossThreadUnretainedWrapper<blink::WaitableEvent> >,void ()>::RunImpl(void(*)(blink::WaitableEvent *) & bound, const std::tuple<WTF::CrossThreadUnretainedWrapper<blink::WaitableEvent> > &) Line 604 C++ Symbols loaded.
libcef.dll!base::internal::Invoker<base::internal::BindState<void (*)(blink::WaitableEvent *),WTF::CrossThreadUnretainedWrapper<blink::WaitableEvent> >,void ()>::Run(base::internal::BindStateBase * base) Line 586 C++ Symbols loaded.
[Inline Frame] libcef.dll!base::OnceCallback<void ()>::Run() Line 95 C++ Symbols loaded.
libcef.dll!base::debug::TaskAnnotator::RunTask(const char * queue_function, base::PendingTask * pending_task) Line 61 C++ Symbols loaded.
libcef.dll!base::internal::IncomingTaskQueue::RunTask(base::PendingTask * pending_task) Line 124 C++ Symbols loaded.
libcef.dll!base::MessageLoop::RunTask(base::PendingTask * pending_task) Line 396 C++ Symbols loaded.
libcef.dll!base::MessageLoop::DeferOrRunPendingTask(base::PendingTask pending_task) Line 407 C++ Symbols loaded.
libcef.dll!base::MessageLoop::DoWork() Line 451 C++ Symbols loaded.
libcef.dll!base::MessagePumpForUI::DoRunLoop() Line 174 C++ Symbols loaded.
libcef.dll!base::MessagePumpWin::Run(base::MessagePump::Delegate * delegate) Line 58 C++ Symbols loaded.
libcef.dll!base::MessageLoop::Run(bool application_tasks_allowed) Line 348 C++ Symbols loaded.
libcef.dll!base::RunLoop::Run() Line 136 C++ Symbols loaded.
libcef.dll!CefBrowserMessageLoop::RunMessageLoop() Line 122 C++ Symbols loaded.
libcef.dll!CefRunMessageLoop() Line 290 C++ Symbols loaded.
Shadow.exe!CefRunMessageLoop() Line 407 C++ Symbols loaded.
Shadow.exe!wWinMain(HINSTANCE__ * hInstance, HINSTANCE__ * hPrevInstance, wchar_t * lpCmdLine, int nCmdShow) Line 22 C++ Symbols loaded.
[External Code] Annotated Frame
When the code enters OnBeforePopup most of the information is pure garbage:
So later when the scoped_refptr for those is freed it throws an access violation:
I'm attaching a minimal example which leads to the crash. There is a lot that this example lacks like shutting down properly and so on. I removed those to make it easier to understand. But the issue is that CEF won't even start with this code.
But there is a way to fix this and make this minimal example start properly. Open up the BrowserEventHandler.h file
- Code: Select all
#pragma once
#include "stdafx.h"
#include "cef_client.h"
#include "wrapper/cef_message_router.h"
class BrowserEventHandler :
public CefClient,
public CefLifeSpanHandler {
public:
CefRefPtr<CefLifeSpanHandler> GetLifeSpanHandler() override {
return this;
}
private:
IMPLEMENT_REFCOUNTING(BrowserEventHandler);
};
If you simply change return this to return NULL like this:
- Code: Select all
#pragma once
#include "stdafx.h"
#include "cef_client.h"
#include "wrapper/cef_message_router.h"
class BrowserEventHandler :
public CefClient,
public CefLifeSpanHandler {
public:
CefRefPtr<CefLifeSpanHandler> GetLifeSpanHandler() override {
return NULL;
}
private:
IMPLEMENT_REFCOUNTING(BrowserEventHandler);
};
Everything works fine.
I tried this with my full project too. If I just remove the LifeSpanHandler it stops crashing. But this is obviously not an option as I have to handle shutdown and so on somehow in my application.
I'd appreciate some help here