Skip to content
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

Some events not set to null in Dispose #2307

Closed
bddckr opened this issue Mar 8, 2018 · 3 comments
Closed

Some events not set to null in Dispose #2307

bddckr opened this issue Mar 8, 2018 · 3 comments

Comments

@bddckr
Copy link

bddckr commented Mar 8, 2018

  • What version of the product are you using?
    CefSharp.OffScreen Version 63.0.1 (Should be the same on 63.0.2, though, because I checked the cefsharp/63 branch at 190c3af)

  • What architecture x86 or x64?
    x64

  • On what operating system?
    Win10

  • Are you using WinForms, WPF or OffScreen?
    OffScreen

  • What steps will reproduce the problem?
    I have a weird scenario in which it's really hard for me to unsubscribe from events on a browser instance before it's disposed by another component. Since there is no Disposing event on the CefSharp components I'm relying on the components turning their events to null in their dispose.
    I'm currently in the process to actually remedy this issue on my end by not relying on implementation details of CefSharp 😉

  • What is the expected output? What do you see instead?
    I'm expecting all events to be set to null to stop referencing any event listener. There are some events that aren't set to null, so I have some event listener objects stay around a bit.

  • Please provide any additional information below.
    I only had a look at the CefSharp.OffScreen.ChromiumWebBrowser component and its JavascriptObjectRepository. Here's what I found:

    protected virtual void Dispose(bool disposing)
    {
    // Don't reference event listeners any longer:
    LoadError = null;
    FrameLoadStart = null;
    FrameLoadEnd = null;
    ConsoleMessage = null;
    BrowserInitialized = null;
    StatusMessage = null;
    LoadingStateChanged = null;
    AddressChanged = null;

    Missing: TitleChanged, Paint/OnPaint+NewScreenshot (depending on branch used: master vs. cefsharp/63)
    public void Dispose()
    {
    ResolveObject = null;
    }

    Missing: ObjectBoundInJavascript

  • Does this problem also occur in the CEF Sample Application from http://opensource.spotify.com/cefbuilds/index.html?
    Doesn't apply.

@amaitland
Copy link
Member

Sounds reasonable. Pull requests welcome.

You can add your own disposed event to work around the problem in the short term.

@bddckr
Copy link
Author

bddckr commented Mar 8, 2018

That's exactly what I'm doing actually! 😄

I'll do a PR but that will have to wait ~2-4 weeks. Since this isn't a big issue (event listeners should be unsubscribed properly instead) I hope that's OK!

@amaitland
Copy link
Member

WinForms and WPF versions should be reviewed as well.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants