I have a project with cefsharp, where it crashes on the close on the form (only when embedded pdf is used), and the dispose of the webview is called.
I use foxit pdf reader.
The code where it crashes:
private void Browser_FormClosing(object sender, FormClosingEventArgs e)
{
if (_web_view != null) //_web_view = CefSharp.WinForms.WebView
{
_web_view.Dispose(); //CRASHES HERE
_web_view = null;
}
}
What i see there in the close event:
case WM_CLOSE:
if (g_handler.get()) {
CefRefPtr<CefBrowser> browser = g_handler->GetBrowser();
if (browser.get()) {
// Let the browser window know we are about to destroy it.
browser->ParentWindowWillClose();
}
}
break;
So I edited the cefsharp.winforms code (WebView.h) in the destructor of the WebView to this and compiled and tried this dll:
~WebView()
{
CefRefPtr<CefBrowser> browser;
if (TryGetCefBrowser(browser))
{
browser->ParentWindowWillClose(); //I added this line
browser->CloseBrowser();
}
}
Still the same error, so it seems like the cefsharp crashes (but the c++ example doesn't) somewhere on the dispose, but I can't find out where...
I alsoo tried using the dll's from the c++ project and use them in my c# project, still the same...