mirror of
https://bitbucket.org/chromiumembedded/cef
synced 2025-06-05 21:39:12 +02:00
Fix crash when destroying the browser window while a context menu is displayed.
git-svn-id: https://chromiumembedded.googlecode.com/svn/trunk@1096 5089003a-bbd8-11dd-ad1f-f1f9622dbc98
This commit is contained in:
@ -43,8 +43,10 @@ CefMenuCreator::~CefMenuCreator() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool CefMenuCreator::IsShowingContextMenu() {
|
bool CefMenuCreator::IsShowingContextMenu() {
|
||||||
content::RenderWidgetHostView* view =
|
content::WebContents* web_contents = browser_->GetWebContents();
|
||||||
browser_->GetWebContents()->GetRenderWidgetHostView();
|
if (!web_contents)
|
||||||
|
return false;
|
||||||
|
content::RenderWidgetHostView* view = web_contents->GetRenderWidgetHostView();
|
||||||
return (view && view->IsShowingContextMenu());
|
return (view && view->IsShowingContextMenu());
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -159,9 +161,12 @@ void CefMenuCreator::MenuWillShow(CefRefPtr<CefMenuModelImpl> source) {
|
|||||||
if (source.get() != model_.get())
|
if (source.get() != model_.get())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
content::WebContents* web_contents = browser_->GetWebContents();
|
||||||
|
if (!web_contents)
|
||||||
|
return;
|
||||||
|
|
||||||
// Notify the host before showing the context menu.
|
// Notify the host before showing the context menu.
|
||||||
content::RenderWidgetHostView* view =
|
content::RenderWidgetHostView* view = web_contents->GetRenderWidgetHostView();
|
||||||
browser_->GetWebContents()->GetRenderWidgetHostView();
|
|
||||||
if (view)
|
if (view)
|
||||||
view->SetShowingContextMenu(true);
|
view->SetShowingContextMenu(true);
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user