summaryrefslogtreecommitdiffstats
path: root/src/webenginewidgets/api/qtwebenginewidgetsglobal.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/webenginewidgets/api/qtwebenginewidgetsglobal.cpp')
-rw-r--r--src/webenginewidgets/api/qtwebenginewidgetsglobal.cpp14
1 files changed, 12 insertions, 2 deletions
diff --git a/src/webenginewidgets/api/qtwebenginewidgetsglobal.cpp b/src/webenginewidgets/api/qtwebenginewidgetsglobal.cpp
index 4feacf748..b17516ad6 100644
--- a/src/webenginewidgets/api/qtwebenginewidgetsglobal.cpp
+++ b/src/webenginewidgets/api/qtwebenginewidgetsglobal.cpp
@@ -38,13 +38,23 @@
#include "qtwebengineglobal.h"
#include <QCoreApplication>
+#include <QOpenGLContext>
QT_BEGIN_NAMESPACE
static void initialize()
{
- QtWebEngine::initialize();
+ //On window/ANGLE, calling QtWebEngine::initialize from DllMain will result in a crash.
+ //To ensure it doesn't, we check that when loading the library
+ //QCoreApplication is not yet instantiated, ensuring the call will be deferred
+#if defined(Q_OS_WIN)
+ if (QCoreApplication::instance()
+ && QOpenGLContext::openGLModuleType() == QOpenGLContext::LibGLES) {
+ return;
+ }
+#endif
+ qAddPreRoutine(QtWebEngine::initialize);
}
-Q_COREAPP_STARTUP_FUNCTION(initialize)
+Q_CONSTRUCTOR_FUNCTION(initialize)
QT_END_NAMESPACE