Details
Description
I have a command line tool, that depending on the arguments sent in by the user, can cause a QWebEngine based widget.
When the args are set up for this, a QApplication is created, otherwise a QCoreApplication was created.
This is done in a similar fashion to what is shown in the help
http://doc.qt.io/qt-5/qapplication.html#details
However, my GUI based flow has a dependency on QWebEngine, and is statically bound in
The problem is, the QWebEngine initialization code, called from qt_call_pre_routines() a QOpenGLContext is created in the webengine initialize() code
shareContext = new QOpenGLContext;
shareContext->create();
And the application crashes in create because QGuiApplicationPrivate::platformIntegration() returns nullptr
The solution was to create a QGUIApplication, rather than a QCoreApplication
QCoreApplication *app = QCoreApplication::instance();
if (!app)
Should really be checking to see if the app is a QGUIApplication, not just any old QCoreApplication