Merge revision 1096 changes:

- Fix crash when destroying the browser window while a context menu is displayed.

git-svn-id: https://chromiumembedded.googlecode.com/svn/branches/1364@1097 5089003a-bbd8-11dd-ad1f-f1f9622dbc98
This commit is contained in:
Marshall Greenblatt 2013-02-13 17:12:30 +00:00
parent 5e0e7ba01c
commit 1f9f57722a
1 changed files with 9 additions and 4 deletions

View File

@ -43,8 +43,10 @@ CefMenuCreator::~CefMenuCreator() {
}
bool CefMenuCreator::IsShowingContextMenu() {
content::RenderWidgetHostView* view =
browser_->GetWebContents()->GetRenderWidgetHostView();
content::WebContents* web_contents = browser_->GetWebContents();
if (!web_contents)
return false;
content::RenderWidgetHostView* view = web_contents->GetRenderWidgetHostView();
return (view && view->IsShowingContextMenu());
}
@ -159,9 +161,12 @@ void CefMenuCreator::MenuWillShow(CefRefPtr<CefMenuModelImpl> source) {
if (source.get() != model_.get())
return;
content::WebContents* web_contents = browser_->GetWebContents();
if (!web_contents)
return;
// Notify the host before showing the context menu.
content::RenderWidgetHostView* view =
browser_->GetWebContents()->GetRenderWidgetHostView();
content::RenderWidgetHostView* view = web_contents->GetRenderWidgetHostView();
if (view)
view->SetShowingContextMenu(true);
}