From f1a67c65312e62c30698c07ab382db64998b8d56 Mon Sep 17 00:00:00 2001 From: Holger Hans Peter Freyther Date: Sat, 19 Nov 2011 20:57:14 +0100 Subject: [PATCH] opengl: Do not crash when programGuard is a nullptr MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The rest of the code is checking programGuard for nullptr, do it here as well to prevent a segmentation fault. Change-Id: I38a03f74d493b8f731157be1739707b39904f7ba Reviewed-by: Samuel Rødal --- src/gui/opengl/qopenglshaderprogram.cpp | 2 +- src/opengl/qglshaderprogram.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/gui/opengl/qopenglshaderprogram.cpp b/src/gui/opengl/qopenglshaderprogram.cpp index 13f0b1da00b..70f9b042c7b 100644 --- a/src/gui/opengl/qopenglshaderprogram.cpp +++ b/src/gui/opengl/qopenglshaderprogram.cpp @@ -936,7 +936,7 @@ void QOpenGLShaderProgram::release() { Q_D(QOpenGLShaderProgram); #ifndef QT_NO_DEBUG - if (d->programGuard->group() != QOpenGLContextGroup::currentContextGroup()) + if (d->programGuard && d->programGuard->group() != QOpenGLContextGroup::currentContextGroup()) qWarning("QOpenGLShaderProgram::release: program is not valid in the current context."); #endif d->glfuncs->glUseProgram(0); diff --git a/src/opengl/qglshaderprogram.cpp b/src/opengl/qglshaderprogram.cpp index 0163d60f0c5..af093bc9b4d 100644 --- a/src/opengl/qglshaderprogram.cpp +++ b/src/opengl/qglshaderprogram.cpp @@ -980,7 +980,7 @@ void QGLShaderProgram::release() { #ifndef QT_NO_DEBUG Q_D(QGLShaderProgram); - if (d->programGuard->group() != QOpenGLContextGroup::currentContextGroup()) + if (d->programGuard && d->programGuard->group() != QOpenGLContextGroup::currentContextGroup()) qWarning("QGLShaderProgram::release: program is not valid in the current context."); #endif #if defined(QT_OPENGL_ES_2)