ManagedCefBrowserAdapter - Throw exception if attempting to call CreateBrowser with a Disposed BrowserSettings instance

This commit is contained in:
amaitland
2019-02-20 20:47:36 +10:00
parent 707db8bb6e
commit cb374cb12f
@@ -19,6 +19,13 @@ bool ManagedCefBrowserAdapter::IsDisposed::get()
void ManagedCefBrowserAdapter::CreateBrowser(IWindowInfo^ windowInfo, BrowserSettings^ browserSettings, RequestContext^ requestContext, String^ address)
{
if (browserSettings->IsDisposed)
{
throw gcnew ObjectDisposedException("browserSettings", "The BrowserSettings reference you have passed has already been disposed. " +
"You cannot reuse the BrowserSettings class at the moment. This may change in the next version, check " +
"https://github.com/cefsharp/CefSharp/issues/2643 for details.");
}
auto cefWindowInfoWrapper = static_cast<WindowInfo^>(windowInfo);
CefString addressNative = StringUtils::ToNative(address);