Skip to content

Commit 8683702

Browse files
committed
Core - IJavascriptCallback need additional null check in ClientAdapter::GetBrowserWrapper
IJavascriptCallbacks that are finalized after the browser has been Disposed but before the IBrowserAdapter.IsDisposed is set might end up calling ClientAdapter::GetBrowserWrapper which attempts to access _popupBrowsers which has been set to null already.
1 parent 41f0ef3 commit 8683702

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

CefSharp.Core.Runtime/Internals/ClientAdapter.cpp

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,8 +51,18 @@ namespace CefSharp
5151
return _browser;
5252
}
5353

54+
//IJavascriptCallbacks that are finalized after the browser has been Disposed
55+
//but before the IBrowserAdapter.IsDisposed is set might end up here
56+
//attempting to access _popupBrowsers which has been set to null already.
57+
auto popupBrowsers = _popupBrowsers;
58+
59+
if (Object::ReferenceEquals(popupBrowsers, nullptr))
60+
{
61+
return nullptr;
62+
}
63+
5464
IBrowser^ popupBrowser;
55-
if (_popupBrowsers->TryGetValue(browserId, popupBrowser))
65+
if (popupBrowsers->TryGetValue(browserId, popupBrowser))
5666
{
5767
return popupBrowser;
5868
}

0 commit comments

Comments
 (0)