summaryrefslogtreecommitdiff
path: root/vcl/source/opengl/OpenGLHelper.cxx
diff options
context:
space:
mode:
authorMichael Meeks <michael.meeks@collabora.com>2015-08-31 11:25:18 +0100
committerCaolán McNamara <caolanm@redhat.com>2015-08-31 10:54:54 +0000
commit11fc36a480e4b775fc1b3fbe70b816a860379f9a (patch)
tree7be9e07ee708a78ea9fd8e1d9f7fa518ec230601 /vcl/source/opengl/OpenGLHelper.cxx
parentf139baa08cb65eba659890802d08ec0486b04260 (diff)
tdf#93798 - avoid apitrace provoked infinite loop dumping errors.
Change-Id: I6c42e6a9ead90ed6fad2f289cd686a72cffa0c2d Reviewed-on: https://gerrit.libreoffice.org/18165 Reviewed-by: Caolán McNamara <caolanm@redhat.com> Tested-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'vcl/source/opengl/OpenGLHelper.cxx')
-rw-r--r--vcl/source/opengl/OpenGLHelper.cxx16
1 files changed, 13 insertions, 3 deletions
diff --git a/vcl/source/opengl/OpenGLHelper.cxx b/vcl/source/opengl/OpenGLHelper.cxx
index f255b3a1141a..958d5237d150 100644
--- a/vcl/source/opengl/OpenGLHelper.cxx
+++ b/vcl/source/opengl/OpenGLHelper.cxx
@@ -400,9 +400,14 @@ void OpenGLHelper::checkGLError(const char* pFile, size_t nLine)
{
OpenGLZone aZone;
- GLenum glErr = glGetError();
- if (glErr != GL_NO_ERROR)
+ int nErrors = 0;
+ for (;;)
{
+ GLenum glErr = glGetError();
+ if (glErr == GL_NO_ERROR)
+ {
+ break;
+ }
const char* sError = OpenGLHelper::GLErrorString(glErr);
if (sError)
@@ -410,7 +415,12 @@ void OpenGLHelper::checkGLError(const char* pFile, size_t nLine)
else
SAL_WARN("vcl.opengl", "GL Error #" << glErr << " (no message available) in File " << pFile << " at line: " << nLine);
- glErr = glGetError();
+ // tdf#93798 - apitrace appears to sometimes cause issues with an infinite loop here.
+ if (++nErrors >= 8)
+ {
+ SAL_WARN("vcl.opengl", "Breaking potentially recursive glGetError loop");
+ break;
+ }
}
}