-
-
Notifications
You must be signed in to change notification settings - Fork 11
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
ChromiumWebBrowser won't be disposed unless calling Dispose explicitly. #13
Comments
~ChromiumWebBrowser()
{
Dispose(false);
} |
There's already a finalizer (in base class |
You can add a class that implements Idisposable, holds a weak reference to the ChromiumWebBrowser instance, pass that to Cef.AddDisposable. |
I didn't understand why pass that to |
I'm suggesting instead of passing a direct reference to Cef.AddDisposable passing what is effectively a weak reference. The remove call would also Need to be updated. |
Sorry, I misunderstood your meaning earlier. This may also be a solution. |
This is the problem you've stated, and that's the problem I'm suggesting a solution for. |
I'd like to introduce |
Is it actually required? Have you tried the default |
For reference the shutdown code now matches the |
To be clear, comment out the |
Hwndhost is not only be disposed when I create a new Window, and put a HwndHost in it. Close the window, wait and call GC. You can see that the finalizer of Hwndhost is called while main thread is waiting for finalizer. And the Dispatcher is still alive. It hasn't shutdown. |
I'm aware of this. I was simply making you aware of the change. I'm not suggesting this is a fix.
Please no images of code. |
I misunderstood that you missed the finalizer could be called by gc. So I just use images to show the callstack and calling sequence. I think Just removing the reference by |
Submit a PR for cleanup element. Making sure all methods are documented and changing of parent windows is handled correctly. |
OK, I'll submit it later. |
Version |
|
HwndHost will call
Dispose
in~HwndHost()
. So it could be disposed implicitly.But in
ChromiumWebBrowser
, the instance has be added to a staticHashSet
byAddDisposable
, so it'll never be finalized.Maybe we should add CleanupElement for it?
The text was updated successfully, but these errors were encountered: