glfw3 gamma test crashes on windows

vittoriolassini wrote on Sunday, June 09, 2013:

gamma.exe built from current master crashes with access violation on Windows 7.
I think the reason is lack of _glfwAllocGammaRamp() call.

glfwSetGammaRamp() calls _glfwPlatformGetGammaRamp(monitor, &monitor->originalRamp) in the case when monitor->originalRamp.size == 0, but there is no _glfwAllocGammaRamp() inside win32_gamma.c _glfwPlatformGetGammaRamp() function. So this function tries to memcpy() to “unallocated” destination.

Actually, there is _glfwAllocGammaRamp() call inside X11 version of _glfwPlatformGetGammaRamp(). I’ve modified code to do _glfwAllocGammaRamp(ramp, 256) before memcpy’s (and removed last line with size assignment because it’s already inside allocation func) and now gamma test works fine.

PS. Sorry for my terrible english.

elmindreda wrote on Sunday, June 09, 2013:

Thank you! This has been fixed.