diff options
author | Jocelyn Turcotte <jturcotte@woboq.com> | 2015-07-20 12:06:59 +0200 |
---|---|---|
committer | Simon Hausmann <simon.hausmann@theqtcompany.com> | 2015-07-23 18:58:00 +0000 |
commit | 8b6bd564eddafe9b3fd42e19367c0f94e860ceed (patch) | |
tree | 3dfbd7b070e9df93fb76ab51284154bce5add3f9 /src/core/web_contents_view_qt.cpp | |
parent | 219ab331c8f6c11975d78a846f16dc6f2c4421ca (diff) |
Fix a crash on new windows
Fixes a regression of 99e98f7bf6aec78fe0d647fb898e65d13ff522e4
by delaying applying the background color if the client hasn't
been set on the WebContentsViewQt yet.
Task-number: QTBUG-41960
Change-Id: I1c138777f616541179976570d8c29f8f4d49ecbf
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@theqtcompany.com>
Diffstat (limited to 'src/core/web_contents_view_qt.cpp')
-rw-r--r-- | src/core/web_contents_view_qt.cpp | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/src/core/web_contents_view_qt.cpp b/src/core/web_contents_view_qt.cpp index aad44c1d9..c32753435 100644 --- a/src/core/web_contents_view_qt.cpp +++ b/src/core/web_contents_view_qt.cpp @@ -53,8 +53,10 @@ void WebContentsViewQt::initialize(WebContentsAdapterClient* client) m_factoryClient = client; // Check if a RWHV was created before the initialization. - if (m_webContents->GetRenderWidgetHostView()) - static_cast<RenderWidgetHostViewQt *>(m_webContents->GetRenderWidgetHostView())->setAdapterClient(client); + if (auto rwhv = static_cast<RenderWidgetHostViewQt *>(m_webContents->GetRenderWidgetHostView())) { + rwhv->setAdapterClient(client); + rwhv->SetBackgroundColor(toSk(client->backgroundColor())); + } } content::RenderWidgetHostViewBase* WebContentsViewQt::CreateViewForWidget(content::RenderWidgetHost* render_widget_host, bool is_guest_view_hack) @@ -86,7 +88,8 @@ void WebContentsViewQt::RenderViewCreated(content::RenderViewHost* host) { // The render process is done creating the RenderView and it's ready to be routed // messages at this point. - host->GetView()->SetBackgroundColor(toSk(m_client->backgroundColor())); + if (m_client) + host->GetView()->SetBackgroundColor(toSk(m_client->backgroundColor())); } void WebContentsViewQt::CreateView(const gfx::Size& initial_size, gfx::NativeView context) |