-
-
Notifications
You must be signed in to change notification settings - Fork 2.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[invalid] custom popup hosting / lifespan with Wpf.HwndHost causes crash on popup with ChromeStyle #4980
Comments
This suggests that window less rendering is still enabled. Does it make a difference if you disable it? It'll be enabled by default if you use the https://github.com/cefsharp/CefSharp/blob/master/CefSharp.Wpf/CefSettings.cs#L18 |
I think this is the problem: https://github.com/cefsharp/CefSharp/blob/master/CefSharp.Wpf/Experimental/LifespanHandler.cs#L216 with using the main WPF sampe for hwndhost I switched to using that, and my actual helper app implemented similar logic calling SetWindowless as it was built for WPF. Removing that prevents the crash. Once #4981 is integrated and the samples merge will just need to slightly modify the handler to work as expected. One other change is likely the delayed close handling. The normal sample app doesn't crash once commenting it out but does have something of an odd behavior. It opens a new window (win #2) but the page opens in another chrome styled window (win #3). Closing Win #2 which is just gray closes Win #3. If you close Win #3 win #2 stays open, which you can then manually close. No matter what you do (close #2 first which closes 3 or close 3 and manually close 2 as well) it isn't properly deregistering as DoClose doesn't get called as the window is destroyed. Looking at the comment though it says
so it sounds like should not just close the window but call that. Otherwise the window handle gets reused which leads to Don't know if I should just close this or leave it open as a reminder to do those two things once merged together. |
Is there an existing issue for this?
CefSharp Version
130
Operating System
Windows 10
Architecture
x64
.Net Version
.net 6
Implementation
WPF
Reproduction Steps
We don't quite have HwndHost integrated into the main CefSharp sample yet but if we did then uncommenting https://github.com/cefsharp/CefSharp/blob/master/CefSharp.Wpf.Example/Views/BrowserTabView.xaml.cs#L129-L183 would result in the crash (note if trying to repro with external HwndHost need to add the experimental handlers to the inclusion).
Once you do so just open a new popup (ie target= _blank) and it will crash.
Expected behavior
Not Crash
Actual behavior
Crashes
Regression?
Doubt it
Known Workarounds
Unable to find any
Does this problem also occur in the CEF Sample Application
No
Other information
This might be a bug in CEF based on the cef code comments but I can't reproduce it so we might be calling down some wrong path. It doesn't happen with WPF (non HwndHost) (or seemingly WinForms) but if the CEF comment is right the flow would only be an issue with chrome style not alloy style windows. See below for more details.
The error occurs because the 'pending popup' var set to empty and then it trying to copy properties from that.
src is: 0x00000000000000a8
(this seems to be a CEF constant for empty for pending popup)
The may be more telling is the code https://github.com/chromiumembedded/cef/blob/e513077eaca4097e2283cb70bcd72c804a6ee922/libcef/browser/browser_info_manager.cc#L318-L321
where it tries to get the pending popup information. If the comment saying
GET_CUSTOM_WEB_CONTENTS_VIEW
should only be used with alloy style maybe that is why this happens? I doubt this specifically given it also does an alloy style check below on pending_popup so maybe it just means GET_CUSTOM_WEB_CONTENTS_VIEW is ignored if not alloy style. Either way poppendingpopup returns empty. If it does mean GET_CUSTOM_WEB_CONTENTS_VIEW shouldn't be called on chrome style then I figured I should be able to reproduce it with:and doing the new popup test. This succeeds though both with and without the
--use-default-popup
arg. The PopPendingPopup function does seem to handle chromestyle too.I tried to repro in WinForms without success as well. I added
CefSharpSettings.RuntimeStyle = CefRuntimeStyle.Chrome;
to program.cs and tried both the normal lifespan handler and setting it equal tobrowser.LifeSpanHandler = new WinFormsLifeSpanHandlerEx();
but I am not sure if that is really a full hosted popup. Without HandlerEx new tabs open fine no matter what target is set to or if shift is held on links (everything just opens as new tab). When set to HandlerEx things that should open in new window do nothing (but no crash), but holding control does cause new tabs to open properly on links.Back to where it does crash I found if you hold control or shift it does not crash when clicking the link with target _blank. Similar to in the non HwndHost WPF version holding control/shift just causes links to open in the same tab. These just don't flow through the lifespan handler for popups.
The text was updated successfully, but these errors were encountered: