mirror of
https://bitbucket.org/chromiumembedded/cef
synced 2025-06-05 21:39:12 +02:00
Check for a valid pointer in all places where GetWebView() and GetWebViewHost() are directly used in order to prevent potential crashes after WM_DESTROY is processed (issue #84).
git-svn-id: https://chromiumembedded.googlecode.com/svn/trunk@97 5089003a-bbd8-11dd-ad1f-f1f9622dbc98
This commit is contained in:
@@ -46,6 +46,7 @@ LRESULT CALLBACK CefBrowserImpl::WndProc(HWND hwnd, UINT message,
|
||||
break;
|
||||
|
||||
case WM_DESTROY:
|
||||
if (browser)
|
||||
{
|
||||
CefRefPtr<CefHandler> handler = browser->GetHandler();
|
||||
if(handler.get()) {
|
||||
@@ -56,6 +57,7 @@ LRESULT CALLBACK CefBrowserImpl::WndProc(HWND hwnd, UINT message,
|
||||
|
||||
// Clean up anything associated with the WebViewHost widget.
|
||||
browser->GetWebViewHost()->webwidget()->close();
|
||||
browser->webviewhost_.reset();
|
||||
|
||||
// Clear the user data pointer.
|
||||
win_util::SetWindowUserData(hwnd, NULL);
|
||||
@@ -150,7 +152,9 @@ void CefBrowserImpl::UIT_CreateBrowser(const std::wstring& url)
|
||||
void CefBrowserImpl::UIT_SetFocus(WebWidgetHost* host, bool enable)
|
||||
{
|
||||
REQUIRE_UIT();
|
||||
|
||||
if (!host)
|
||||
return;
|
||||
|
||||
if (enable)
|
||||
::SetFocus(host->view_handle());
|
||||
else if (::GetFocus() == host->view_handle())
|
||||
|
Reference in New Issue
Block a user