From d2ebda89d1cceacaa0148b73e3b276c951ef9732 Mon Sep 17 00:00:00 2001 From: JanEggers Date: Thu, 15 May 2014 19:51:53 +0200 Subject: [PATCH] i tested the merged code again and got access violations in ManagedCefAdapter.Dispose because it was called after Cef.Terminate so i added some more cleanup insanity --- CefSharp.Wpf/WebView.cs | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/CefSharp.Wpf/WebView.cs b/CefSharp.Wpf/WebView.cs index 0cb5b1d38..023e6bb78 100644 --- a/CefSharp.Wpf/WebView.cs +++ b/CefSharp.Wpf/WebView.cs @@ -40,6 +40,7 @@ namespace CefSharp.Wpf private Popup popup; private ScaleTransform dpiTransform; private readonly List disposables = new List(); + private static readonly List webViews = new List(); public BrowserSettings BrowserSettings { get; set; } public bool IsBrowserInitialized { get; private set; } @@ -265,6 +266,8 @@ namespace CefSharp.Wpf { disposable.Dispose(); } + + webViews.Remove(this); } #endregion CleanupElement dependency property @@ -316,6 +319,7 @@ namespace CefSharp.Wpf public WebView() { + webViews.Add(this); Focusable = true; FocusVisualStyle = null; IsTabStop = true; @@ -405,6 +409,10 @@ namespace CefSharp.Wpf // control should not explicitly have to perform this. if (Cef.IsInitialized) { + foreach (var webView in webViews.ToList()) + { + webView.Cleanup(); + } GC.Collect(); GC.WaitForPendingFinalizers();