Skip to content

Commit

Permalink
LifeSpanHandler - Don't set to null on Dispose
Browse files Browse the repository at this point in the history
Resolves #10
  • Loading branch information
amaitland committed Apr 5, 2021
1 parent b4eba31 commit f02eb3a
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions CefSharp.Wpf.HwndHost/ChromiumWebBrowser.cs
Original file line number Diff line number Diff line change
Expand Up @@ -751,8 +751,10 @@ private void InternalDispose(bool disposing)
TitleChanged = null;
JavascriptMessageReceived = null;

// Release reference to handlers, except LifeSpanHandler which is done after Disposing
// ManagedCefBrowserAdapter otherwise the ILifeSpanHandler.DoClose will not be invoked.
// Release reference to handlers, except LifeSpanHandler which we don't set to null
//so that ILifeSpanHandler.DoClose will not be invoked. Previously we set LifeSpanHandler = null
//after managedCefBrowserAdapter.Dispose, there's still cases where the LifeSpanHandler was null
//when DoClose was called Issue https://github.com/cefsharp/CefSharp.Wpf.HwndHost/issues/10
FindHandler = null;
DialogHandler = null;
RequestHandler = null;
Expand All @@ -771,10 +773,6 @@ private void InternalDispose(bool disposing)

managedCefBrowserAdapter?.Dispose();
managedCefBrowserAdapter = null;

// LifeSpanHandler is set to null after managedCefBrowserAdapter.Dispose so ILifeSpanHandler.DoClose
// is called.
LifeSpanHandler = null;
}

Cef.RemoveDisposable(this);
Expand Down

0 comments on commit f02eb3a

Please sign in to comment.