Skip to content

Commit

Permalink
Create BrowserSettings in ChromiumWebBrowser constructor and explicit…
Browse files Browse the repository at this point in the history
…ly call Dispose (it references an unmanaged resource)
  • Loading branch information
amaitland committed Dec 16, 2014
1 parent 7bc7cd2 commit 25203c5
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion CefSharp.Wpf/ChromiumWebBrowser.cs
Original file line number Diff line number Diff line change
Expand Up @@ -338,6 +338,9 @@ public void Dispose()

protected virtual void Dispose(bool isdisposing)
{
BrowserSettings.Dispose();

BrowserSettings = null;
ResourceHandler = null;

Loaded -= OnLoaded;
Expand Down Expand Up @@ -470,6 +473,7 @@ public ChromiumWebBrowser()
disposables.Add(new DisposableEventWrapper(this, ActualWidthProperty, OnActualSizeChanged));

ResourceHandler = new DefaultResourceHandler();
BrowserSettings = new BrowserSettings();
}

~ChromiumWebBrowser()
Expand All @@ -484,7 +488,7 @@ private void CreateOffscreenBrowserWhenActualSizeChanged()
return;
}

managedCefBrowserAdapter.CreateOffscreenBrowser(BrowserSettings ?? new BrowserSettings(), Address);
managedCefBrowserAdapter.CreateOffscreenBrowser(BrowserSettings, Address);
browserCreated = true;
}

Expand Down

0 comments on commit 25203c5

Please sign in to comment.