From 77e4c61190a4d685d891fd7a7e629442f0716e43 Mon Sep 17 00:00:00 2001 From: Camilla Berglund Date: Thu, 13 Jun 2013 18:29:21 +0200 Subject: [PATCH] Fixed broken WGL error detection. Context creation was attempted even if no valid pixel formats had been found during enumeration. --- README.md | 3 +++ src/wgl_context.c | 8 ++++++-- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index d7e0555a..70aae477 100644 --- a/README.md +++ b/README.md @@ -100,6 +100,9 @@ See the [GLFW 3.0 documentation](http://www.glfw.org/docs/3.0/). ## Changelog + - [Win32] Bugfix: Context creation was attempted even if no valid pixel formats + had been found + ## Contact diff --git a/src/wgl_context.c b/src/wgl_context.c index d98ba063..61d9a22e 100644 --- a/src/wgl_context.c +++ b/src/wgl_context.c @@ -276,9 +276,13 @@ static GLboolean choosePixelFormat(_GLFWwindow* window, } closest = _glfwChooseFBConfig(desired, usableConfigs, usableCount); - if (closest) - *result = closest->wgl; + if (!closest) + { + free(usableConfigs); + return GL_FALSE; + } + *result = closest->wgl; free(usableConfigs); return GL_TRUE;