From 9d325441635c2dd7383973f2a82c5d2e575445d1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=BCri=20Valdmann?= Date: Tue, 19 Nov 2019 13:00:00 +0100 Subject: Fix renderProcessTerminated signal With the adaptations for Chromium 76, RenderWidgetHostViewQt was changed to become a RenderProcessHostObserver with the renderProcessTerminated signal being emitted from the override of RenderProcessHostObserver::RenderProcessExited. The problem with this can be seen by setting a breakpoint on the RenderProcessGone override in RenderWidgetHostViewQt. We then get the trace: QtWebEngineCore::RenderWidgetHostViewQt::RenderProcessGone content::RenderWidgetHostImpl::RendererExited() content::RenderViewHostImpl::RenderProcessExited content::RenderProcessHostImpl::ProcessDied ProcessDied iterates over all the observers and calls RenderProcessExited. Both the RenderViewHostImpl and our RWHVQt are observers, but the RVHImpl comes first. The RVHImpl then calls RendererExited, which calls our RenderProcessGone, which does a 'delete this'. Now our RenderProcessExited override can never be called because we have already deleted our observer. Fix by moving the RenderProcessGone code to WebContentsDelegateQt and getting the exit code from WebContents::GetCrashedErrorCode. Also add test. Task-number: QTBUG-80085 Change-Id: I434744286df97a37b64722d7c15a1d4ee11c8af6 Reviewed-by: Allan Sandfeld Jensen --- src/core/render_widget_host_view_qt.cpp | 14 -------------- 1 file changed, 14 deletions(-) (limited to 'src/core/render_widget_host_view_qt.cpp') diff --git a/src/core/render_widget_host_view_qt.cpp b/src/core/render_widget_host_view_qt.cpp index e2fd074ae..15cc5174e 100644 --- a/src/core/render_widget_host_view_qt.cpp +++ b/src/core/render_widget_host_view_qt.cpp @@ -340,7 +340,6 @@ RenderWidgetHostViewQt::RenderWidgetHostViewQt(content::RenderWidgetHost *widget // May call SetNeedsBeginFrames host()->SetView(this); - host()->GetProcess()->AddObserver(this); } RenderWidgetHostViewQt::~RenderWidgetHostViewQt() @@ -354,7 +353,6 @@ RenderWidgetHostViewQt::~RenderWidgetHostViewQt() if (text_input_manager_) text_input_manager_->RemoveObserver(this); - host()->GetProcess()->RemoveObserver(this); m_touchSelectionController.reset(); m_touchSelectionControllerClient.reset(); @@ -704,18 +702,6 @@ void RenderWidgetHostViewQt::ImeCompositionRangeChanged(const gfx::Range&, const QT_NOT_YET_IMPLEMENTED } -void RenderWidgetHostViewQt::RenderProcessExited(content::RenderProcessHost *host, - const content::ChildProcessTerminationInfo &info) -{ - Q_UNUSED(host); - // RenderProcessHost::FastShutdownIfPossible results in TERMINATION_STATUS_STILL_RUNNING - if (m_adapterClient && info.status != base::TERMINATION_STATUS_STILL_RUNNING) { - m_adapterClient->renderProcessTerminated( - m_adapterClient->renderProcessExitStatus(info.status), - info.exit_code); - } -} - void RenderWidgetHostViewQt::RenderProcessGone() { Destroy(); -- cgit v1.2.3