From 11fc36a480e4b775fc1b3fbe70b816a860379f9a Mon Sep 17 00:00:00 2001 From: Michael Meeks Date: Mon, 31 Aug 2015 11:25:18 +0100 Subject: tdf#93798 - avoid apitrace provoked infinite loop dumping errors. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Change-Id: I6c42e6a9ead90ed6fad2f289cd686a72cffa0c2d Reviewed-on: https://gerrit.libreoffice.org/18165 Reviewed-by: Caolán McNamara Tested-by: Caolán McNamara --- vcl/source/opengl/OpenGLHelper.cxx | 16 +++++++++++++--- 1 file 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; + } } } -- cgit v1.2.1