From 342f18c71f51227a062bd204037541ecae150846 Mon Sep 17 00:00:00 2001 From: Alexandru Croitor Date: Tue, 4 Oct 2016 12:58:02 +0200 Subject: Check qgl_current_fbo_invalid before using qgl_current_fbo QSG24BitTextMaskShader::useSRGB() on macOS accesses the current context qgl_current_fbo member without first checking if it is valid. Make sure it also checks qgl_current_fbo_invalid, thus not accidentally dereferencing a dangling pointer. Change-Id: I56a77de23ee3b4b271bd848506ff26e14d7b6d15 Reviewed-by: Laszlo Agocs --- src/quick/scenegraph/qsgdefaultglyphnode_p.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src/quick/scenegraph/qsgdefaultglyphnode_p.cpp') diff --git a/src/quick/scenegraph/qsgdefaultglyphnode_p.cpp b/src/quick/scenegraph/qsgdefaultglyphnode_p.cpp index 3eba29ba41..5ef5c79416 100644 --- a/src/quick/scenegraph/qsgdefaultglyphnode_p.cpp +++ b/src/quick/scenegraph/qsgdefaultglyphnode_p.cpp @@ -233,7 +233,8 @@ bool QSG24BitTextMaskShader::useSRGB() const // m_useSRGB is true, but if some QOGLFBO was bound check it's texture format: QOpenGLContext *ctx = QOpenGLContext::currentContext(); QOpenGLFramebufferObject *qfbo = QOpenGLContextPrivate::get(ctx)->qgl_current_fbo; - return !qfbo || qfbo->format().internalTextureFormat() == GL_SRGB8_ALPHA8_EXT; + bool fboInvalid = QOpenGLContextPrivate::get(ctx)->qgl_current_fbo_invalid; + return !qfbo || fboInvalid || qfbo->format().internalTextureFormat() == GL_SRGB8_ALPHA8_EXT; #else return m_useSRGB; #endif -- cgit v1.2.3