diff --git a/src/init.c b/src/init.c index 97551115..0ff2b61f 100644 --- a/src/init.c +++ b/src/init.c @@ -70,6 +70,10 @@ GLFWAPI void glfwTerminate(void) if (!_glfwInitialized) return; + // Close all remaining windows + while (_glfwLibrary.windowListHead) + glfwCloseWindow(_glfwLibrary.windowListHead); + if (!_glfwPlatformTerminate()) return; diff --git a/src/win32/win32_init.c b/src/win32/win32_init.c index a9c17087..488e9d3e 100644 --- a/src/win32/win32_init.c +++ b/src/win32/win32_init.c @@ -178,9 +178,6 @@ int _glfwPlatformInit(void) int _glfwPlatformTerminate(void) { - while (_glfwLibrary.windowListHead) - glfwCloseWindow(_glfwLibrary.windowListHead); - if (_glfwLibrary.Win32.classAtom) { UnregisterClass(_GLFW_WNDCLASSNAME, _glfwLibrary.Win32.instance); diff --git a/src/x11/x11_init.c b/src/x11/x11_init.c index 4c35043e..aaf90a5d 100644 --- a/src/x11/x11_init.c +++ b/src/x11/x11_init.c @@ -220,9 +220,6 @@ int _glfwPlatformInit(void) int _glfwPlatformTerminate(void) { - while (_glfwLibrary.windowListHead) - glfwCloseWindow(_glfwLibrary.windowListHead); - if (_glfwLibrary.X11.cursor) { XFreeCursor(_glfwLibrary.X11.display, _glfwLibrary.X11.cursor);