Skip to content

Commit 325ec0f

Browse files
merceyzamaitland
authored andcommitted
Fixed NullReferenceException in DoClose (#1980)
* Fixed NullReferenceException in DoClose
1 parent d0ce4ea commit 325ec0f

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

CefSharp.Core/Internals/ClientAdapter.cpp

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -200,9 +200,12 @@ namespace CefSharp
200200

201201
if (handler != nullptr)
202202
{
203-
auto browserWrapper = GetBrowserWrapper(browser->GetIdentifier(), browser->IsPopup());
204-
205-
return handler->DoClose(_browserControl, browserWrapper);
203+
//By this point it's possible IBrowser references have been disposed
204+
//Rather than attempting to rework the rather complex closing logic
205+
//It's easier to pass in a new wrapper and dispose it straight away
206+
CefSharpBrowserWrapper browserWrapper(browser);
207+
208+
return handler->DoClose(_browserControl, %browserWrapper);
206209
}
207210

208211
return false;

0 commit comments

Comments
 (0)