Terminate the library
| 60 | // Terminate the library |
| 61 | // |
| 62 | static void terminate(void) |
| 63 | { |
| 64 | int i; |
| 65 | |
| 66 | memset(&_glfw.callbacks, 0, sizeof(_glfw.callbacks)); |
| 67 | |
| 68 | while (_glfw.windowListHead) |
| 69 | glfwDestroyWindow((GLFWwindow*) _glfw.windowListHead); |
| 70 | |
| 71 | while (_glfw.cursorListHead) |
| 72 | glfwDestroyCursor((GLFWcursor*) _glfw.cursorListHead); |
| 73 | |
| 74 | for (i = 0; i < _glfw.monitorCount; i++) |
| 75 | { |
| 76 | _GLFWmonitor* monitor = _glfw.monitors[i]; |
| 77 | if (monitor->originalRamp.size) |
| 78 | _glfwPlatformSetGammaRamp(monitor, &monitor->originalRamp); |
| 79 | _glfwFreeMonitor(monitor); |
| 80 | } |
| 81 | |
| 82 | free(_glfw.monitors); |
| 83 | _glfw.monitors = NULL; |
| 84 | _glfw.monitorCount = 0; |
| 85 | |
| 86 | free(_glfw.mappings); |
| 87 | _glfw.mappings = NULL; |
| 88 | _glfw.mappingCount = 0; |
| 89 | |
| 90 | _glfwTerminateVulkan(); |
| 91 | _glfwPlatformTerminate(); |
| 92 | |
| 93 | _glfw.initialized = GLFW_FALSE; |
| 94 | |
| 95 | while (_glfw.errorListHead) |
| 96 | { |
| 97 | _GLFWerror* error = _glfw.errorListHead; |
| 98 | _glfw.errorListHead = error->next; |
| 99 | free(error); |
| 100 | } |
| 101 | |
| 102 | _glfwPlatformDestroyTls(&_glfw.contextSlot); |
| 103 | _glfwPlatformDestroyTls(&_glfw.errorSlot); |
| 104 | _glfwPlatformDestroyMutex(&_glfw.errorLock); |
| 105 | |
| 106 | memset(&_glfw, 0, sizeof(_glfw)); |
| 107 | } |
| 108 | |
| 109 | |
| 110 | ////////////////////////////////////////////////////////////////////////// |
no test coverage detected