diff options
author | Joerg Bornemann <joerg.bornemann@theqtcompany.com> | 2016-04-19 14:44:34 +0200 |
---|---|---|
committer | Joerg Bornemann <joerg.bornemann@theqtcompany.com> | 2016-04-21 08:41:54 +0000 |
commit | 78ff3973c8745d8e12a0e71bd37dea47be954741 (patch) | |
tree | fff2341f856fb255a945f3b4f187595f73bc080e /src/webenginewidgets | |
parent | 783db9da6962c331b126f0d2262a0c0600cf46ff (diff) |
Fix crash when instantiating a QCoreApplication
When linking against QtWebEngineWidgets, a Q_COREAPP_STARTUP_FUNCTION is
installed, which is then called from QCoreApplication::init.
In that function, check whether qApp is a QGuiApplication or derivative
before calling QtWebEngineCore::initialize.
Change-Id: I16a3cdda2c707040ad3707a83a192fcb9059ddc4
Task-number: QTBUG-51789
Task-number: QTBUG-52539
Reviewed-by: Andy Shaw <andy.shaw@theqtcompany.com>
Diffstat (limited to 'src/webenginewidgets')
-rw-r--r-- | src/webenginewidgets/api/qtwebenginewidgetsglobal.cpp | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/src/webenginewidgets/api/qtwebenginewidgetsglobal.cpp b/src/webenginewidgets/api/qtwebenginewidgetsglobal.cpp index 1ef6386ad..263376e45 100644 --- a/src/webenginewidgets/api/qtwebenginewidgetsglobal.cpp +++ b/src/webenginewidgets/api/qtwebenginewidgetsglobal.cpp @@ -36,7 +36,7 @@ #include "qtwebenginewidgetsglobal.h" -#include <QCoreApplication> +#include <QGuiApplication> namespace QtWebEngineCore { @@ -46,6 +46,10 @@ namespace QtWebEngineCore QT_BEGIN_NAMESPACE static void initialize() { + // Bail out silently if the user did not construct a QGuiApplication. + if (!qobject_cast<QGuiApplication *>(QCoreApplication::instance())) + return; + QtWebEngineCore::initialize(); } |