CreateBrowser vs. CreateBrowserSync

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.

CreateBrowser vs. CreateBrowserSync

Postby sdiverdi » Fri Feb 19, 2021 3:40 pm

I just had quite a debugging experience and I'm curious about the behavior I observed. I changed CreateBrowser to CreateBrowserSync and found that after that change, when closing the browser through browser->GetHost()->CloseBrowser(false), that the usual DoClose call happens and after that, no call to OnBeforeClose ever comes and the app fails to quit. If I change CreateBrowserSync back to CreateBrowser (no other changes) then the shutdown sequence occurs as expected (CloseBrowser, then DoClose, then OnBeforeClose, then process terminates).

The CefBrowserHost comments for CreateBrowser and CreateBrowserSync don't seem to indicate a difference like this. Is there some different shutdown behavior necessary for CreateBrowserSync? Or is this a bug? This is on osx, with build 88.2.0+g6a304f5+chromium-88.0.4324.96 .
sdiverdi
Mentor
 
Posts: 51
Joined: Fri Dec 25, 2020 7:41 pm

Re: CreateBrowser vs. CreateBrowserSync

Postby magreenblatt » Fri Feb 19, 2021 5:16 pm

How are you running the message loop? Where are you calling CreateBrowser/CreateBrowserSync?
magreenblatt
Site Admin
 
Posts: 12382
Joined: Fri May 29, 2009 6:57 pm

Re: CreateBrowser vs. CreateBrowserSync

Postby sdiverdi » Fri Feb 19, 2021 5:48 pm

My code is based on cefsimple so the message loop is run in the app main and CreateBrowser is called in SimpleApp's OnContextInitialized. In fact I just tested: a fresh clone of cef-project, build cefsimple and run works fine, change the call to CreateBrowser in simple_app.cc to CreateBrowserSync and has the same problem: DoClose gets called but not OnBeforeClose and the process doesn't terminate until I kill it.
sdiverdi
Mentor
 
Posts: 51
Joined: Fri Dec 25, 2020 7:41 pm

Re: CreateBrowser vs. CreateBrowserSync

Postby magreenblatt » Fri Feb 19, 2021 7:29 pm

Does the browser otherwise behave normally?
magreenblatt
Site Admin
 
Posts: 12382
Joined: Fri May 29, 2009 6:57 pm

Re: CreateBrowser vs. CreateBrowserSync

Postby sdiverdi » Fri Feb 19, 2021 8:42 pm

Yep seems like it. When I use CreateBrowserSync in cefsimple I'm able to search on Google, go to other pages, create new windows, close those windows (and see calls to OnBeforeClose), keep browsing, and then when I quit (command-q) the last OnBeforeClose never comes in. (Presumably the new windows that are creating during usage aren't created with CreateBrowserSync, which may be why they're able to close successfully.)

I should add using the fresh cef-project clone, it's using CEF binary 87.1.12+g03f9336+chromium-87.0.4280.88 instead. That's why I wonder if this is a usage problem instead of a bug -- the CreateBrowserSync comments don't seem to suggest that it needs to be called / handled differently than CreateBrowserSync, but this same behavior exists in both 4280 and 4324. But the problem is easy to see, just take the regular cefsimple project and replace the CreateBrowser call in simple_app.cc with CreateBrowserSync, and the app will fail to quit properly (on osx at least, I'm building with xcode 12.4 on 10.15.7).
sdiverdi
Mentor
 
Posts: 51
Joined: Fri Dec 25, 2020 7:41 pm

Re: CreateBrowser vs. CreateBrowserSync

Postby magreenblatt » Fri Feb 19, 2021 9:04 pm

Please add a bug.
magreenblatt
Site Admin
 
Posts: 12382
Joined: Fri May 29, 2009 6:57 pm

Re: CreateBrowser vs. CreateBrowserSync

Postby magreenblatt » Thu Apr 29, 2021 4:45 pm

This is likely the same problem that’s described at https://bitbucket.org/chromiumembedded/ ... t-60442115. Maybe something to do with NSAutoReleasePool scope.
magreenblatt
Site Admin
 
Posts: 12382
Joined: Fri May 29, 2009 6:57 pm


Return to Support Forum

Who is online

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