From 875de90ff8ecdad69fa8ffe76e39ba5da8d2dc2d Mon Sep 17 00:00:00 2001
From: Yoann Lopes <yoann.lopes@digia.com>
Date: Tue, 17 Sep 2013 17:00:28 +0200
Subject: [PATCH] Fix QVideoSurfaceArbFpPainter mistakenly failing to start in
 some cases.

If an OpenGL error occurred before starting the video painter, it would
fail to do so. This patch simply makes sure the OpenGL error flag is
cleared before checking for GL errors that would occur in
QVideoSurfaceArbFpPainter's code.

Change-Id: I2eacf6db03cb290adf00a9faf11145c7a6ade565
Reviewed-by: Christian Stromme <christian.stromme@digia.com>
---
 src/multimediawidgets/qpaintervideosurface.cpp | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/src/multimediawidgets/qpaintervideosurface.cpp b/src/multimediawidgets/qpaintervideosurface.cpp
index 8536ba4d1..d9ad0438d 100644
--- a/src/multimediawidgets/qpaintervideosurface.cpp
+++ b/src/multimediawidgets/qpaintervideosurface.cpp
@@ -773,6 +773,8 @@ QAbstractVideoSurface::Error QVideoSurfaceArbFpPainter::start(const QVideoSurfac
     if (!program) {
         error = QAbstractVideoSurface::UnsupportedFormatError;
     } else {
+        while (glGetError() != GL_NO_ERROR) { } // clear previous unrelated errors
+
         glGenProgramsARB(1, &m_programId);
 
         GLenum glError = glGetError();
-- 
GitLab