diff options
author | Tom Cooksey <thomas.cooksey@nokia.com> | 2009-09-01 16:50:41 (GMT) |
---|---|---|
committer | Tom Cooksey <thomas.cooksey@nokia.com> | 2009-09-01 17:13:23 (GMT) |
commit | 400d72d5c4b1556ddcc188d82a24d5439f728bbe (patch) | |
tree | 63c0b4ec6466084e8e5f51bbfd480b8b34f1e4b2 /src/opengl/gl2paintengineex | |
parent | e4804c5d3d2e80cc7f57936591374d29478dbb2a (diff) | |
download | Qt-400d72d5c4b1556ddcc188d82a24d5439f728bbe.zip Qt-400d72d5c4b1556ddcc188d82a24d5439f728bbe.tar.gz Qt-400d72d5c4b1556ddcc188d82a24d5439f728bbe.tar.bz2 |
Don't seg-fault when printing error message in shader manager
It's very likely that some of the shader objects in required program
will be null, as not all are manditory. Check to see if they exist
before de-referencing them and asking for their log string.
Reviewed-by: Trustme
Diffstat (limited to 'src/opengl/gl2paintengineex')
-rw-r--r-- | src/opengl/gl2paintengineex/qglengineshadermanager.cpp | 36 |
1 files changed, 25 insertions, 11 deletions
diff --git a/src/opengl/gl2paintengineex/qglengineshadermanager.cpp b/src/opengl/gl2paintengineex/qglengineshadermanager.cpp index 891c027..d48a7b6 100644 --- a/src/opengl/gl2paintengineex/qglengineshadermanager.cpp +++ b/src/opengl/gl2paintengineex/qglengineshadermanager.cpp @@ -570,20 +570,34 @@ bool QGLEngineShaderManager::useCorrectShaderProg() requiredProgram.program->link(); if (!requiredProgram.program->isLinked()) { + QLatin1String none("none"); + QLatin1String br("\n"); QString error; - qWarning() << "Shader program failed to link," + error = QLatin1String("Shader program failed to link,") #if defined(QT_DEBUG) - << '\n' - << " Shaders Used:" << '\n' - << " mainVertexShader = " << requiredProgram.mainVertexShader->objectName() << '\n' - << " positionVertexShader = " << requiredProgram.positionVertexShader->objectName() << '\n' - << " mainFragShader = " << requiredProgram.mainFragShader->objectName() << '\n' - << " srcPixelFragShader = " << requiredProgram.srcPixelFragShader->objectName() << '\n' - << " maskFragShader = " << requiredProgram.maskFragShader->objectName() << '\n' - << " compositionFragShader = "<< requiredProgram.compositionFragShader->objectName() << '\n' + + br + + QLatin1String(" Shaders Used:\n") + + QLatin1String(" mainVertexShader = ") + + (requiredProgram.mainVertexShader ? + requiredProgram.mainVertexShader->objectName() : none) + br + + QLatin1String(" positionVertexShader = ") + + (requiredProgram.positionVertexShader ? + requiredProgram.positionVertexShader->objectName() : none) + br + + QLatin1String(" mainFragShader = ") + + (requiredProgram.mainFragShader ? + requiredProgram.mainFragShader->objectName() : none) + br + + QLatin1String(" srcPixelFragShader = ") + + (requiredProgram.srcPixelFragShader ? + requiredProgram.srcPixelFragShader->objectName() : none) + br + + QLatin1String(" maskFragShader = ") + + (requiredProgram.maskFragShader ? + requiredProgram.maskFragShader->objectName() : none) + br + + QLatin1String(" compositionFragShader = ") + + (requiredProgram.compositionFragShader ? + requiredProgram.compositionFragShader->objectName() : none) + br #endif - << " Error Log:" << '\n' - << " " << requiredProgram.program->log(); + + QLatin1String(" Error Log:\n") + + QLatin1String(" ") + requiredProgram.program->log(); qWarning() << error; delete requiredProgram.program; } else { |