When I Called "CefMsgLoop", Breakpoint 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.

When I Called "CefMsgLoop", Breakpoint hit during shutdown

Postby mung » Thu Jul 06, 2017 11:56 pm

Hi ~ :)

I use cef ver 3.3071.1634.g9cc59c8 and window 7

And I use OSR Mode.

I tried process "CEF MessageLoop" in other thread like following codes.

However, When I called "CefShutDown()" it happend trigger (breakpoint in following image.)

This case happen When I called "CefMessageLoopWork" even once.
(Actually, This case happen When I called drawing web page even once.)

If I didn't call "CefMessageLoopWork" not happend trigger.

I don't know what do I ? what's wrong ? :(


image1.JPG
image1.JPG (125.39 KiB) Viewed 7057 times


main thread called close
Code: Select all
m_pBrowser->GetHost()->CloseBrowser(true);


create web browser thread
Code: Select all
GWebThreadHandle = BEGINTHREADEX(NULL, WEBTHREAD_STACKSIZE, WebBrowserThread, pInArgList, 0, NULL);


process CefMessageLoopWork
Code: Select all
DWORD WINAPI WebBrwoserThread(LPVOID param)
{
    CefMainArgs main_args(hInstance);

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

    bool result = CefInitialize(main_args, settings, GWebBrowserApp.get(), NULL);

    while(!GWebExti)
    {
        if(NULL != GWebThreadEvent)
        {
            ::WaitForSingleObject(GWebThreadEvent, INFINITE);
        }

        if(GwebExit)
        {
            break;
        }

        CefDoMessageLoopWork();
    }

    CefShutdown();

    return 0;
}
mung
Mentor
 
Posts: 58
Joined: Wed Jan 04, 2017 12:20 am

Re: When I Called "CefMsgLoop", Breakpoint hit during shutdo

Postby mung » Mon Jul 10, 2017 12:47 am

I got a this log

"char str_stack[1024] : FATAL:weak_ptr.cc(20) Check failed: sequence_checker_.CalledOnValidSequence() || HasOneRef().
WeakPrts must be invalidated on the same sequenced thread."


However, I tried "BrowserAppCreating", "CefInitialize" And "cefshutdown" in same thread.

Also, Same happened When I tried in "main thread".

:(
mung
Mentor
 
Posts: 58
Joined: Wed Jan 04, 2017 12:20 am

Re: When I Called "CefMsgLoop", Breakpoint hit during shutdo

Postby magreenblatt » Mon Jul 10, 2017 12:38 pm

CefInitialize, CefShutdown, etc., must be called on the main application thread (the thread that is running when main is called), not some other thread that you create in your application.
magreenblatt
Site Admin
 
Posts: 12407
Joined: Fri May 29, 2009 6:57 pm

Re: When I Called "CefMsgLoop", Breakpoint hit during shutdo

Postby mung » Mon Jul 10, 2017 8:01 pm

magreenblatt wrote:CefInitialize, CefShutdown, etc., must be called on the main application thread (the thread that is running when main is called), not some other thread that you create in your application.


Thank you for your reply.

When I tried main application thread Same happened.
What kind of function's do I have to call before call "Cefshutdown()" ?



It is not happened, When I called "CefExecuteProcess() -> CefInitialize() -> CefShutdow()"
However, It's happened, When I called "CefExecuteProcess() -> CefInitialize() -> LoadURL() -> CloseBrowser() -> CefShutdow()".
mung
Mentor
 
Posts: 58
Joined: Wed Jan 04, 2017 12:20 am

Re: When I Called "CefMsgLoop", Breakpoint hit during shutdo

Postby magreenblatt » Mon Jul 10, 2017 9:06 pm

You need to run the message loop before calling CefShutdown. When you close a browser you need to wait for the call to OnBeforeClose.
magreenblatt
Site Admin
 
Posts: 12407
Joined: Fri May 29, 2009 6:57 pm

Re: When I Called "CefMsgLoop", Breakpoint hit during shutdo

Postby mung » Mon Jul 10, 2017 9:36 pm

magreenblatt wrote:You need to run the message loop before calling CefShutdown. When you close a browser you need to wait for the call to OnBeforeClose.


Thank you your reply. :)

I tried this steps.

"CefExecuteProcess() -> CefInitialize() -> LoadURL() -> CefDoMessageLoopWork() (every tick) -> CloseBrowser() -> OnBeforeClose() -> (few ticks) -> CefDoMessageLoopWork() -> CefShutdow()".

Sadly, Same happend ;(

Why It's happen When I called LoadURL() and CloseBrowser() ?

What do I have to check ?
mung
Mentor
 
Posts: 58
Joined: Wed Jan 04, 2017 12:20 am

Re: When I Called "CefMsgLoop", Breakpoint hit during shutdo

Postby mung » Mon Jul 10, 2017 11:47 pm

magreenblatt wrote:You need to run the message loop before calling CefShutdown. When you close a browser you need to wait for the call to OnBeforeClose.



It's not happen When I Set "single_process = false;".

However, I wanna use single_process.
How do I have to ?
mung
Mentor
 
Posts: 58
Joined: Wed Jan 04, 2017 12:20 am

Re: When I Called "CefMsgLoop", Breakpoint hit during shutdo

Postby magreenblatt » Tue Jul 11, 2017 11:20 am

Ah, I didn't notice that you were using single-process mode. That mode is not supported.
magreenblatt
Site Admin
 
Posts: 12407
Joined: Fri May 29, 2009 6:57 pm

Re: When I Called "CefMsgLoop", Breakpoint hit during shutdo

Postby mung » Tue Jul 11, 2017 8:23 pm

magreenblatt wrote:Ah, I didn't notice that you were using single-process mode. That mode is not supported.


Isn't supported single-process mode?
But, It is working.

When I'm not use single-process mode, CEF does replicated process.
Howeve, I use single-process mode, It doesn't replicated process.


Then Do I must not to single-process mode ?
Or Can I use single-process mode ?


I don't want to replicated process. :(
mung
Mentor
 
Posts: 58
Joined: Wed Jan 04, 2017 12:20 am

Re: When I Called "CefMsgLoop", Breakpoint hit during shutdo

Postby magreenblatt » Tue Jul 11, 2017 8:32 pm

magreenblatt
Site Admin
 
Posts: 12407
Joined: Fri May 29, 2009 6:57 pm

Next

Return to Support Forum

Who is online

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