summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndy Shaw <andy.shaw@qt.io>2021-04-08 13:42:55 +0200
committerAndy Shaw <andy.shaw@qt.io>2021-04-12 12:07:37 +0200
commit6e128d4408c599511f45f6b4cd89860d7b9f7c1c (patch)
tree748819c7023e466f86615aabcf89a68b1ff83002
parent11ddd321f181d29fddc5ba998c0be85c2f3de166 (diff)
Depend on QCoreApplication::startingUp() for checking existence of app
When using QtWebView with WebEngine then it will hook the call to QtWebEngine::initialize() to the start up of the application object which means it will output the warning because it already exists. However there is still time at this point to set what is needed because it is still being initialized. So by checking if the application is running (i.e. !startingUp()) then we can be safe in knowing that it is still able to do the initialization. Change-Id: I8c5d8808b4b09e1e7bbf4be52e5efc0786ce1472 Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
-rw-r--r--src/webengine/api/qtwebengineglobal.cpp3
1 files changed, 1 insertions, 2 deletions
diff --git a/src/webengine/api/qtwebengineglobal.cpp b/src/webengine/api/qtwebengineglobal.cpp
index 4346832c9..47b729ebc 100644
--- a/src/webengine/api/qtwebengineglobal.cpp
+++ b/src/webengine/api/qtwebengineglobal.cpp
@@ -72,8 +72,7 @@ namespace QtWebEngine {
*/
void initialize()
{
- QCoreApplication *app = QCoreApplication::instance();
- if (app) {
+ if (!QCoreApplication::startingUp()) {
qWarning("QtWebEngine::initialize() called with QCoreApplication object already created and should be call before. "\
"This is depreciated and may fail in the future.");
QtWebEngineCore::initialize();