From 45c4221a517d2fc1638ccc9de0755248e2c3b1aa Mon Sep 17 00:00:00 2001 From: Vasiliy Vdovichenko Date: Thu, 17 Mar 2016 16:20:00 +0200 Subject: [PATCH] Fixed Wpf ChromiumWebBrowser throws ObjectDisposedException after dispose - https://github.com/cefsharp/CefSharp/issues/1631 --- CefSharp.Core/Internals/CefBrowserHostWrapper.cpp | 5 ++++- CefSharp.Wpf/ChromiumWebBrowser.cs | 2 +- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/CefSharp.Core/Internals/CefBrowserHostWrapper.cpp b/CefSharp.Core/Internals/CefBrowserHostWrapper.cpp index ce122b5bc..7151d1ab0 100644 --- a/CefSharp.Core/Internals/CefBrowserHostWrapper.cpp +++ b/CefSharp.Core/Internals/CefBrowserHostWrapper.cpp @@ -243,7 +243,10 @@ void CefBrowserHostWrapper::SendKeyEvent(int message, int wParam, int lParam) double CefBrowserHostWrapper::GetZoomLevelOnUI() { - ThrowIfDisposed(); + if (_disposed) + { + return 0.0; + } CefTaskScheduler::EnsureOn(TID_UI, "CefBrowserHostWrapper::GetZoomLevel"); diff --git a/CefSharp.Wpf/ChromiumWebBrowser.cs b/CefSharp.Wpf/ChromiumWebBrowser.cs index ee2ec3f52..f45467de6 100644 --- a/CefSharp.Wpf/ChromiumWebBrowser.cs +++ b/CefSharp.Wpf/ChromiumWebBrowser.cs @@ -582,7 +582,7 @@ namespace CefSharp.Wpf var task = this.GetZoomLevelAsync(); task.ContinueWith(previous => { - if (previous.IsCompleted) + if (previous.Status == TaskStatus.RanToCompletion) { UiThreadRunAsync(() => {