osr: Fix potential null ptr dereference during DnD
This commit is contained in:
parent
fe119b9d65
commit
79f4ad960d
|
@ -333,12 +333,20 @@ void CefBrowserPlatformDelegateOsr::DragTargetDragEnter(
|
||||||
|
|
||||||
const gfx::Point client_pt(event.x, event.y);
|
const gfx::Point client_pt(event.x, event.y);
|
||||||
gfx::PointF transformed_pt;
|
gfx::PointF transformed_pt;
|
||||||
current_rwh_for_drag_ =
|
|
||||||
web_contents->GetInputEventRouter()
|
// Some random crashes occured when GetWeakPtr is called on a null pointer
|
||||||
->GetRenderWidgetHostAtPoint(
|
// that is the return of GetRenderWidgetHostAtPoint As the root cause is not
|
||||||
web_contents->GetRenderViewHost()->GetWidget()->GetView(),
|
// yet understood (no reproducible scenario yet), the current fix is only a
|
||||||
gfx::PointF(client_pt), &transformed_pt)
|
// protection against null pointer dereferencing.
|
||||||
->GetWeakPtr();
|
content::RenderWidgetHostImpl* ptr_current_rwh_for_drag =
|
||||||
|
web_contents->GetInputEventRouter()->GetRenderWidgetHostAtPoint(
|
||||||
|
web_contents->GetRenderViewHost()->GetWidget()->GetView(),
|
||||||
|
gfx::PointF(client_pt), &transformed_pt);
|
||||||
|
if (!ptr_current_rwh_for_drag) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
current_rwh_for_drag_ = ptr_current_rwh_for_drag->GetWeakPtr();
|
||||||
|
|
||||||
current_rvh_for_drag_ = web_contents->GetRenderViewHost();
|
current_rvh_for_drag_ = web_contents->GetRenderViewHost();
|
||||||
|
|
||||||
drag_data_ = drag_data;
|
drag_data_ = drag_data;
|
||||||
|
|
Loading…
Reference in New Issue