mirror of
https://github.com/glfw/glfw.git
synced 2024-11-26 06:14:35 +00:00
Fix deletion of uninitialized POSIX TLS key
Zero (the initial value of context) is a valid TLS key, so doing this can delete someone else's key. Fixes #627.
This commit is contained in:
parent
43f4afef78
commit
cdf08c1ff3
@ -41,11 +41,13 @@ int _glfwCreateContextTLS(void)
|
||||
return GLFW_FALSE;
|
||||
}
|
||||
|
||||
_glfw.posix_tls.allocated = GLFW_TRUE;
|
||||
return GLFW_TRUE;
|
||||
}
|
||||
|
||||
void _glfwDestroyContextTLS(void)
|
||||
{
|
||||
if (_glfw.posix_tls.allocated)
|
||||
pthread_key_delete(_glfw.posix_tls.context);
|
||||
}
|
||||
|
||||
|
@ -37,6 +37,7 @@
|
||||
//
|
||||
typedef struct _GLFWtlsPOSIX
|
||||
{
|
||||
GLFWbool allocated;
|
||||
pthread_key_t context;
|
||||
|
||||
} _GLFWtlsPOSIX;
|
||||
|
Loading…
Reference in New Issue
Block a user