Skip to content

Commit 8c9dbb7

Browse files
committed
ILifeSpanHandler.OnBeforeClose the IBrowser wrapper was already disposed, so for now just create a new wrapper and dispose of it immediately after the call
1 parent 1986f9e commit 8c9dbb7

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

CefSharp.Core/Internals/ClientAdapter.cpp

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -205,9 +205,14 @@ namespace CefSharp
205205

206206
if (handler != nullptr)
207207
{
208-
auto browserWrapper = GetBrowserWrapper(browser->GetIdentifier(), isPopup);
208+
//By this point the other IBrowser references have been disposed
209+
//Rather than attempting to rework the rather complex closing logic
210+
//It's easier to pass in a new wrapper and dispose it straight away
211+
auto browserWrapper = gcnew CefSharpBrowserWrapper(browser);
209212

210213
handler->OnBeforeClose(_browserControl, browserWrapper);
214+
215+
delete browserWrapper;
211216
}
212217

213218
if (isPopup)

0 commit comments

Comments
 (0)