summaryrefslogtreecommitdiffstats
path: root/src/core/api
diff options
context:
space:
mode:
authorCorentin Jabot <corentinjabot@gmail.com>2015-12-16 10:18:30 +0100
committerJoerg Bornemann <joerg.bornemann@theqtcompany.com>2016-04-28 12:39:27 +0000
commita8564cc6fb40fe6a9c3f5f6f37392a628aa5b685 (patch)
tree351239294a30d992e4459818ec89e43e77cce625 /src/core/api
parentf77cd97cacd1603fdca0c3fda405d351a1ccda93 (diff)
Never call QtWebEngine::initialize from DllMain
On windows, calling QtWebEngine::initialize from DllMain may crash, depending on what QPA backend is used. We make sure to only add a qAddPreRoutine initializing QtWebEngine if there is no instance of QCoreApplication. By doing so, we support linking to QtWebEngineWidget from a plugin, while still initializing the WebEngine automatically when linked to the main application binary. Task-number: QTBUG-46720 Reviewed-by: Jocelyn Turcotte (Woboq GmbH) <jturcotte@woboq.com> (cherry picked from commit 6a8d99ab00ace2084820547572dc05ac8ad2bc5a) Change-Id: Id3b2c1e21e01808cef124f8ece6b247b1ba613cb Reviewed-by: Michael BrĂ¼ning <michael.bruning@theqtcompany.com>
Diffstat (limited to 'src/core/api')
-rw-r--r--src/core/api/qtwebenginecoreglobal.cpp5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/core/api/qtwebenginecoreglobal.cpp b/src/core/api/qtwebenginecoreglobal.cpp
index 0e857d7d9..e60e6139e 100644
--- a/src/core/api/qtwebenginecoreglobal.cpp
+++ b/src/core/api/qtwebenginecoreglobal.cpp
@@ -75,6 +75,11 @@ QWEBENGINE_PRIVATE_EXPORT void initialize()
qFatal("QtWebEngine::initialize() must be called after the construction of the application object.");
return;
}
+
+ // Bail out silently if the user did not construct a QGuiApplication.
+ if (!qobject_cast<QGuiApplication *>(app))
+ return;
+
if (app->thread() != QThread::currentThread()) {
qFatal("QtWebEngine::initialize() must be called from the Qt gui thread.");
return;