diff options
Diffstat (limited to 'src/opengl/qopenglvertexarrayobject.cpp')
-rw-r--r-- | src/opengl/qopenglvertexarrayobject.cpp | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/src/opengl/qopenglvertexarrayobject.cpp b/src/opengl/qopenglvertexarrayobject.cpp index 9c85d73c22f..7f28a0bc617 100644 --- a/src/opengl/qopenglvertexarrayobject.cpp +++ b/src/opengl/qopenglvertexarrayobject.cpp @@ -103,6 +103,7 @@ public: : vao(0) , vaoFuncsType(NotSupported) , context(nullptr) + , guiThread(nullptr) { } @@ -137,6 +138,7 @@ public: } vaoFuncsType; QOpenGLContext *context; + QThread *guiThread; }; bool QOpenGLVertexArrayObjectPrivate::create() @@ -161,6 +163,8 @@ bool QOpenGLVertexArrayObjectPrivate::create() context = ctx; QObject::connect(context, SIGNAL(aboutToBeDestroyed()), q, SLOT(_q_contextAboutToBeDestroyed())); + guiThread = qGuiApp->thread(); + if (ctx->isOpenGLES()) { if (ctx->format().majorVersion() >= 3 || ctx->hasExtension(QByteArrayLiteral("GL_OES_vertex_array_object"))) { vaoFuncs.helper = new QOpenGLVertexArrayObjectHelper(ctx); @@ -210,7 +214,7 @@ void QOpenGLVertexArrayObjectPrivate::destroy() // Before going through the effort of creating an offscreen surface // check that we are on the GUI thread because otherwise many platforms // will not able to create that offscreen surface. - if (QThread::currentThread() != qGuiApp->thread()) { + if (QThread::currentThread() != guiThread) { ctx = nullptr; } else { // Cannot just make the current surface current again with another context. |