| 417 | } |
| 418 | |
| 419 | GLFWAPI void glfwDestroyWindow(GLFWwindow* handle) |
| 420 | { |
| 421 | _GLFWwindow* window = (_GLFWwindow*) handle; |
| 422 | |
| 423 | _GLFW_REQUIRE_INIT(); |
| 424 | |
| 425 | // Allow closing of NULL (to match the behavior of free) |
| 426 | if (window == NULL) |
| 427 | return; |
| 428 | |
| 429 | // Clear all callbacks to avoid exposing a half torn-down window object |
| 430 | memset(&window->callbacks, 0, sizeof(window->callbacks)); |
| 431 | |
| 432 | // The window's context must not be current on another thread when the |
| 433 | // window is destroyed |
| 434 | if (window == _glfwPlatformGetTls(&_glfw.contextSlot)) |
| 435 | glfwMakeContextCurrent(NULL); |
| 436 | |
| 437 | _glfwPlatformDestroyWindow(window); |
| 438 | |
| 439 | // Unlink window from global linked list |
| 440 | { |
| 441 | _GLFWwindow** prev = &_glfw.windowListHead; |
| 442 | |
| 443 | while (*prev != window) |
| 444 | prev = &((*prev)->next); |
| 445 | |
| 446 | *prev = window->next; |
| 447 | } |
| 448 | |
| 449 | free(window); |
| 450 | } |
| 451 | |
| 452 | GLFWAPI int glfwWindowShouldClose(GLFWwindow* handle) |
| 453 | { |
no test coverage detected