Fix when calling QSurfaceFormat::setDefaultFormat before Q*Application
Fixes a regression introduced in commit 51767affb.
QOpenGLContext::globalShareContext requires a QGuiApplication to exist.
This wasn't required so far.
Task-number: QTBUG-56614
Change-Id: I07bcf434fca536c4dc50feee7ea17eb541fd589a
Reviewed-by: Liang Qi <liang.qi@qt.io>
bb10
parent
10b9321c1d
commit
f773ddd026
|
|
@ -36,6 +36,7 @@
|
|||
#include <QtCore/qatomic.h>
|
||||
#include <QtCore/QDebug>
|
||||
#include <QOpenGLContext>
|
||||
#include <QtGui/qguiapplication.h>
|
||||
|
||||
#ifdef major
|
||||
#undef major
|
||||
|
|
@ -760,10 +761,13 @@ Q_GLOBAL_STATIC(QSurfaceFormat, qt_default_surface_format)
|
|||
void QSurfaceFormat::setDefaultFormat(const QSurfaceFormat &format)
|
||||
{
|
||||
#ifndef QT_NO_OPENGL
|
||||
QOpenGLContext *globalContext = QOpenGLContext::globalShareContext();
|
||||
if (globalContext && globalContext->isValid()) {
|
||||
qWarning("Warning: Setting a new default format with a different version or profile after "
|
||||
"the global shared context is created may cause issues with context sharing.");
|
||||
if (qApp) {
|
||||
QOpenGLContext *globalContext = QOpenGLContext::globalShareContext();
|
||||
if (globalContext && globalContext->isValid()) {
|
||||
qWarning("Warning: Setting a new default format with a different version or profile "
|
||||
"after the global shared context is created may cause issues with context "
|
||||
"sharing.");
|
||||
}
|
||||
}
|
||||
#endif
|
||||
*qt_default_surface_format() = format;
|
||||
|
|
|
|||
Loading…
Reference in New Issue