-
-
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
WinForms browser has to be removed from Controls before dispose #1574
Comments
By default https://github.com/cefsharp/CefSharp/blob/master/CefSharp/ILifeSpanHandler.cs#L109 |
Hi Alex, Do you see any differences in the two approaches? Better/safer to use ILifeSpanHandler? |
Either should be fine. Typically I'd remove the control or it's parent, then https://github.com/cefsharp/CefSharp/blob/master/CefSharp.WinForms.Example/BrowserForm.cs#L137 The documentation of |
Thanks! I'll just clean up normally for now. |
- Make it so that closing a tab in the WinForms example does not close the entire application. We need to make sure that the LifeSpanHandler is still around when `managedCefBrowserAdapter` is disposed since it is going to call `CloseBrowser`. That way, we can implement LifeSpanHandler and reject closing the entire application as described in (this issue)[cefsharp#1574]
- Make it so that closing a tab in the WinForms example does not close the entire application. We need to make sure that the LifeSpanHandler is still around when `managedCefBrowserAdapter` is disposed since it is going to call `CloseBrowser`. That way, we can implement LifeSpanHandler and reject closing the entire application as described in cefsharp#1574
- Make it so that the lifespan handler is still called when the ChromiumWebBrowser is disposed We need to make sure that the LifeSpanHandler is still around when `managedCefBrowserAdapter` is disposed since it is going to call `CloseBrowser`. That way, we can implement LifeSpanHandler and reject closing the entire application as described in cefsharp#1574
- Make it so that the lifespan handler is still called when the ChromiumWebBrowser is disposed We need to make sure that the LifeSpanHandler is still around when `managedCefBrowserAdapter` is disposed since it is going to call `CloseBrowser`. That way, we can implement LifeSpanHandler and reject closing the entire application as described in #1574
I've found out that when using ChromiumWebBrowser on a (Win)Form, one should remove it from Controls collection before calling browser.Dispose().
If that's not the case then the MDI container or the form (when not a MDI child) will just close. Looks like WM_CLOSE is passed to the main form in such case for some reason. Not sure if this is documented anywhere.
Repro code:
The text was updated successfully, but these errors were encountered: