Make native access functions verify context API

The native access functions for context handles did not verify that the
context had been created with the same API the function was for.

This makes these functions emit GLFW_NO_WINDOW_CONTEXT on API mismatch.

(cherry picked from commit cca9008db2)
This commit is contained in:
Camilla Löwy
2021-10-04 20:32:32 +02:00
parent cec0b33ee1
commit 2d3ce6eaae
6 changed files with 20 additions and 7 deletions
+2 -2
View File
@@ -674,7 +674,7 @@ GLFWAPI GLXContext glfwGetGLXContext(GLFWwindow* handle)
_GLFWwindow* window = (_GLFWwindow*) handle;
_GLFW_REQUIRE_INIT_OR_RETURN(NULL);
if (window->context.client == GLFW_NO_API)
if (window->context.client != GLFW_NATIVE_CONTEXT_API)
{
_glfwInputError(GLFW_NO_WINDOW_CONTEXT, NULL);
return NULL;
@@ -688,7 +688,7 @@ GLFWAPI GLXWindow glfwGetGLXWindow(GLFWwindow* handle)
_GLFWwindow* window = (_GLFWwindow*) handle;
_GLFW_REQUIRE_INIT_OR_RETURN(None);
if (window->context.client == GLFW_NO_API)
if (window->context.client != GLFW_NATIVE_CONTEXT_API)
{
_glfwInputError(GLFW_NO_WINDOW_CONTEXT, NULL);
return None;