Windowless windows not always windowless

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.

Windowless windows not always windowless

Postby callum » Wed Mar 07, 2018 7:38 pm

CEF 3.3282.1742.g96f907e on 64bit Windows.

My application creates several OSR CEF instances and displays the contents via an OpenGL texture.

Very occasionally, a native window is created and the contents shown instead of being rendered offscreen.

The only difference I see between what I do and what cefclient does is i call

Code: Select all
CefWindowInfo window_info;
window_info.windowless_rendering_enabled = true;


but not

Code: Select all
window_info.SetAsWindowless(hWnd);


Is that necessary or likely to help? I only ask here because it's a day long process to push out a new version and then happens once in 100 times so confirmation that it might fix it would be reassuring.
callum
Expert
 
Posts: 326
Joined: Mon Feb 23, 2015 6:19 pm

Re: Windowless windows not always windowless

Postby magreenblatt » Wed Mar 07, 2018 8:47 pm

That shouldn't make a difference (though you should specify a parent hwnd for menus and dialogs to work correctly). Is the problem new with 3282 branch?
magreenblatt
Site Admin
 
Posts: 12409
Joined: Fri May 29, 2009 6:57 pm

Re: Windowless windows not always windowless

Postby callum » Wed Mar 07, 2018 8:57 pm

No - I think this one has been around for a few versions but as I said, it's hard find and reproduce - once QA found it though, it was game over :)

Even if I could get it to trigger on my dev system, I'm not sure how I could figure out what was going on. The OpenGL window's texture is empty because CEF isn't rendering off screen and the OS window that appears seems to be parented on the CEF instance - when the OpenGL window is closed and the associated CEF instance goes away, so does the native window.
callum
Expert
 
Posts: 326
Joined: Mon Feb 23, 2015 6:19 pm

Re: Windowless windows not always windowless

Postby callum » Mon Mar 12, 2018 5:36 pm

Finally have a local repro and digging into the issue.

In my implementation of CefLifespanHandler::OnBeforePopup(), if the target_frame_name has a value, I trigger a callback that tell my app a popup occurred (which creates a whole new CEF instance) and then return true which according to the header docs: " To cancel creation of the popup browser return true.".

I am either something wrong there or that's not working right because *sometimes* the popup appears - I initially mistook it for some strange new window that ignored the windlowless settings.

It's still quite tricky to repro - I delete the cache, let a large, complex page start loading and then when it's partially loaded, I open the page of links I use to test and click on the one that opens with a target of "_blank".

I don't know how to try to repro it in cefclient.

Am I doing the right thing inside OnBeforePopup(), how can I debug why returning true is still allowing creation of the popup?
callum
Expert
 
Posts: 326
Joined: Mon Feb 23, 2015 6:19 pm

Re: Windowless windows not always windowless

Postby magreenblatt » Mon Mar 12, 2018 5:51 pm

callum wrote:In my implementation of CefLifespanHandler::OnBeforePopup(), if the target_frame_name has a value, I trigger a callback that tell my app a popup occurred (which creates a whole new CEF instance) and then return true which according to the header docs: " To cancel creation of the popup browser return true.".

Are you creating the new browser (calling CreateBrowserSync) while inside the OnBeforePopup callback? Or does the creation happen asynchronously?

The code that handles popups is rather complicated [1]. I wouldn't be hugely surprised if there's a race condition.

[1] https://bitbucket.org/chromiumembedded/ ... ager.h-138
magreenblatt
Site Admin
 
Posts: 12409
Joined: Fri May 29, 2009 6:57 pm

Re: Windowless windows not always windowless

Postby callum » Mon Mar 12, 2018 6:08 pm

The code that handles popups is rather complicated [1]. I wouldn't be hugely surprised if there's a race condition.


Yeah, I can only imagine.

Creation is asynchronous and separate - my app loads a DLL containing a whole new instance of CEF each time a new "window" is required - windows in this case is a bespoke windowing system that uses OpenGL - so I don't think there can be any interaction between them. Only connection is the cache & cookie store.
callum
Expert
 
Posts: 326
Joined: Mon Feb 23, 2015 6:19 pm

Re: Windowless windows not always windowless

Postby magreenblatt » Mon Mar 12, 2018 6:46 pm

callum wrote:Creation is asynchronous and separate - my app loads a DLL containing a whole new instance of CEF each time a new "window" is required - windows in this case is a bespoke windowing system that uses OpenGL - so I don't think there can be any interaction between them. Only connection is the cache & cookie store.

If this is in the same process then presumably you're using the same CEF instance (CefInitialize only called a single time in the process). If it's a separate process (calling CefInitialize multiple times), and the multiple processes/instances exist at the same time, then you shouldn't be sharing the same cache_path directory between them.
magreenblatt
Site Admin
 
Posts: 12409
Joined: Fri May 29, 2009 6:57 pm

Re: Windowless windows not always windowless

Postby callum » Mon Mar 12, 2018 7:07 pm

That's good to know, thank you.

I'll need to rethink how that works then since there are quite a few instances around at any one time - maybe as many as a dozen or more. Some are neatly defined, like the login page or the search screen but many are just used to display web content on arbitrary geometry that users create.

Good to know that needs some attention - thank you.
callum
Expert
 
Posts: 326
Joined: Mon Feb 23, 2015 6:19 pm

Re: Windowless windows not always windowless

Postby callum » Tue Mar 13, 2018 4:33 pm

From what I can tell, when the bug is triggered, my implementation of CefLifeSpanHandler::OnBeforePopup() is not called and the popup window is generated by CEF.

When I visit the same links in a scenario where the bug isn't triggered, OnBeforePopup() does get called as expected and my app does the right thing.

What can I be doing wrong that would cause OnBeforePopup() not to be called when you click on a link like
Code: Select all
<a target="_blank" href="https://news.google.com">Link</a>
callum
Expert
 
Posts: 326
Joined: Mon Feb 23, 2015 6:19 pm

Re: Windowless windows not always windowless

Postby magreenblatt » Tue Mar 13, 2018 4:59 pm

Are you getting a call to CefRequestHandler::OnOpenURLFromTab?
magreenblatt
Site Admin
 
Posts: 12409
Joined: Fri May 29, 2009 6:57 pm

Next

Return to Support Forum

Who is online

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

cron