提交 b90ce694 编写于 作者: J jpark37

libobs-opengl: Fix glGetError() infinite loop

glGetError() returns GL_INVALID_OPERATION during OBS shutdown when GL is
used on Windows. This change gives up after eight errors.

This could be avoided by stopping the graphics thread before window
destruction, but the shutdown code looks like it could be tricky to
reorder.
上级 8af49016
......@@ -27,10 +27,18 @@ static inline bool gl_success(const char *funcname)
{
GLenum errorcode = glGetError();
if (errorcode != GL_NO_ERROR) {
int attempts = 8;
do {
blog(LOG_ERROR, "%s failed, glGetError returned 0x%X",
funcname, errorcode);
errorcode = glGetError();
--attempts;
if (attempts == 0) {
blog(LOG_ERROR, "Too many GL errors, moving on",
funcname, errorcode);
break;
}
} while (errorcode != GL_NO_ERROR);
return false;
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册