From b6683549626e5a0131a708842f555dd35d413b50 Mon Sep 17 00:00:00 2001 From: Michal Klocek Date: Tue, 4 Dec 2018 15:20:59 +0100 Subject: Fix recursion in WebEngineContext constructor Gpu process startup needs sync point manager and it can ask for current web engine context, while is being created. Moreover this call will take place from GPU thread, so it leads to race condition. Done-With: Kirill Burtsev Fixes: QTBUG-72113 Change-Id: I43bf37da0cf28ccb5c5cee0d82ed541053016e2e Reviewed-by: Kirill Burtsev Reviewed-by: Allan Sandfeld Jensen --- src/core/web_engine_context.cpp | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'src/core/web_engine_context.cpp') diff --git a/src/core/web_engine_context.cpp b/src/core/web_engine_context.cpp index a1c647f40..0763b9dac 100644 --- a/src/core/web_engine_context.cpp +++ b/src/core/web_engine_context.cpp @@ -270,6 +270,8 @@ WebEngineContext *WebEngineContext::current() qAddPostRoutine(WebEngineContext::destroyContextPostRoutine); // Add a false reference so there is no race between unreferencing m_handle and a global QApplication. m_handle->AddRef(); + // This is need since gpu process start requires sync point manager; + m_handle->initialize(); } return m_handle.get(); } @@ -329,6 +331,9 @@ WebEngineContext::WebEngineContext() : m_mainDelegate(new ContentMainDelegateQt) , m_globalQObject(new QObject()) , m_syncPointManager(new gpu::SyncPointManager()) +{} + +void WebEngineContext::initialize() { base::TaskScheduler::Create("Browser"); m_contentRunner.reset(content::ContentMainRunner::Create()); -- cgit v1.2.3