From d3978d733ffba103bfd60b53ded1e47fc5b03075 Mon Sep 17 00:00:00 2001 From: Allan Sandfeld Jensen Date: Thu, 10 Sep 2015 13:55:09 +0200 Subject: Fix assert on exit Remove frame loading error-page when frame is deleted, and make sure WebContents is destroyed before the observer so the observer can observe the full live-span including deletions.. Task-number: QTBUG-47945 Change-Id: I56bec611b8bfbfc6f75a1bc2108efbc80a81729b Reviewed-by: Joerg Bornemann --- src/core/web_contents_adapter.cpp | 2 ++ src/core/web_contents_delegate_qt.cpp | 5 +++++ src/core/web_contents_delegate_qt.h | 1 + 3 files changed, 8 insertions(+) diff --git a/src/core/web_contents_adapter.cpp b/src/core/web_contents_adapter.cpp index 8c13035e8..e35319fdd 100644 --- a/src/core/web_contents_adapter.cpp +++ b/src/core/web_contents_adapter.cpp @@ -330,6 +330,8 @@ WebContentsAdapterPrivate::WebContentsAdapterPrivate() WebContentsAdapterPrivate::~WebContentsAdapterPrivate() { + // Destroy the WebContents first + webContents.reset(); } QExplicitlySharedDataPointer WebContentsAdapter::createFromSerializedNavigationHistory(QDataStream &input, WebContentsAdapterClient *adapterClient) diff --git a/src/core/web_contents_delegate_qt.cpp b/src/core/web_contents_delegate_qt.cpp index f9db91b3e..c16c76f75 100644 --- a/src/core/web_contents_delegate_qt.cpp +++ b/src/core/web_contents_delegate_qt.cpp @@ -143,6 +143,11 @@ void WebContentsDelegateQt::HandleKeyboardEvent(content::WebContents *, const co m_viewClient->unhandledKeyEvent(reinterpret_cast(event.os_event)); } +void WebContentsDelegateQt::RenderFrameDeleted(content::RenderFrameHost *render_frame_host) +{ + m_loadingErrorFrameList.removeOne(render_frame_host->GetRoutingID()); +} + void WebContentsDelegateQt::DidStartProvisionalLoadForFrame(content::RenderFrameHost* render_frame_host, const GURL& validated_url, bool is_error_page, bool is_iframe_srcdoc) { if (is_error_page) { diff --git a/src/core/web_contents_delegate_qt.h b/src/core/web_contents_delegate_qt.h index 254177d24..41acf7c84 100644 --- a/src/core/web_contents_delegate_qt.h +++ b/src/core/web_contents_delegate_qt.h @@ -91,6 +91,7 @@ public: virtual void MoveValidationMessage(content::WebContents *web_contents, const gfx::Rect &anchor_in_root_view) Q_DECL_OVERRIDE; // WebContentsObserver overrides + virtual void RenderFrameDeleted(content::RenderFrameHost *render_frame_host) Q_DECL_OVERRIDE; virtual void DidStartProvisionalLoadForFrame(content::RenderFrameHost *render_frame_host, const GURL &validated_url, bool is_error_page, bool is_iframe_srcdoc) Q_DECL_OVERRIDE; virtual void DidCommitProvisionalLoadForFrame(content::RenderFrameHost *render_frame_host, const GURL &url, ui::PageTransition transition_type) Q_DECL_OVERRIDE; virtual void DidFailProvisionalLoad(content::RenderFrameHost *render_frame_host, const GURL &validated_url, int error_code, const base::string16 &error_description) Q_DECL_OVERRIDE; -- cgit v1.2.3