diff --git a/examples/heightmap.c b/examples/heightmap.c index 5139a493..94e2bb95 100644 --- a/examples/heightmap.c +++ b/examples/heightmap.c @@ -595,6 +595,8 @@ int main(int argc, char** argv) free(vertex_shader_src); free(fragment_shader_src); + + glfwTerminate(); exit(EXIT_FAILURE); } @@ -608,6 +610,8 @@ int main(int argc, char** argv) fprintf(stderr, "ERROR: unable to resolve OpenGL function pointers\n"); free(vertex_shader_src); free(fragment_shader_src); + + glfwTerminate(); exit(EXIT_FAILURE); } /* Prepare opengl resources for rendering */ @@ -619,6 +623,8 @@ int main(int argc, char** argv) { fprintf(stderr, "ERROR: during creation of the shader program\n"); usage(); + + glfwTerminate(); exit(EXIT_FAILURE); } @@ -683,6 +689,7 @@ int main(int argc, char** argv) } } + glfwTerminate(); exit(EXIT_SUCCESS); } diff --git a/examples/splitview.c b/examples/splitview.c index 4a48a383..92fa6c22 100644 --- a/examples/splitview.c +++ b/examples/splitview.c @@ -463,6 +463,8 @@ int main(void) if (!window) { fprintf(stderr, "Failed to open GLFW window\n"); + + glfwTerminate(); exit(EXIT_FAILURE); } diff --git a/examples/triangle.c b/examples/triangle.c index 615483a9..3a1cef94 100644 --- a/examples/triangle.c +++ b/examples/triangle.c @@ -27,6 +27,8 @@ int main(void) if (!window) { fprintf(stderr, "Failed to open GLFW window\n"); + + glfwTerminate(); exit(EXIT_FAILURE); } diff --git a/readme.html b/readme.html index a40e1d35..cf5eb5b8 100644 --- a/readme.html +++ b/readme.html @@ -318,6 +318,7 @@ version of GLFW.

  • Removed the entire threading API
  • Removed the entire image loading API
  • Removed deprecated Carbon port
  • +
  • Removed registering glfwTerminate with atexit
  • Removed glfwSleep function
  • Removed glfwGetNumberOfProcessors function
  • Removed glfwGetGLVersion function
  • diff --git a/src/init.c b/src/init.c index 12d806cc..efcea20c 100644 --- a/src/init.c +++ b/src/init.c @@ -127,8 +127,6 @@ GLFWAPI int glfwInit(void) return GL_FALSE; } - atexit(glfwTerminate); - _glfwInitialized = GL_TRUE; // Not all window hints have zero as their default value diff --git a/tests/glfwinfo.c b/tests/glfwinfo.c index 3b262852..792e4bd5 100644 --- a/tests/glfwinfo.c +++ b/tests/glfwinfo.c @@ -106,7 +106,10 @@ static void list_extensions(int api, int major, int minor) { PFNGLGETSTRINGIPROC glGetStringi = (PFNGLGETSTRINGIPROC) glfwGetProcAddress("glGetStringi"); if (!glGetStringi) + { + glfwTerminate(); exit(EXIT_FAILURE); + } glGetIntegerv(GL_NUM_EXTENSIONS, &count); @@ -267,7 +270,10 @@ int main(int argc, char** argv) window = glfwCreateWindow(0, 0, GLFW_WINDOWED, "Version", NULL); if (!window) + { + glfwTerminate(); exit(EXIT_FAILURE); + } glfwMakeContextCurrent(window); diff --git a/tests/modes.c b/tests/modes.c index ef1db71c..60dbb8fa 100644 --- a/tests/modes.c +++ b/tests/modes.c @@ -157,6 +157,8 @@ static void test_modes(void) if (!window_handle) { printf("User terminated program\n"); + + glfwTerminate(); exit(EXIT_SUCCESS); } } @@ -224,6 +226,7 @@ int main(int argc, char** argv) else if (mode == TEST_MODE) test_modes(); + glfwTerminate(); exit(EXIT_SUCCESS); } diff --git a/tests/peter.c b/tests/peter.c index 59c917e9..d803c2a1 100644 --- a/tests/peter.c +++ b/tests/peter.c @@ -120,6 +120,8 @@ int main(void) if (!open_window()) { fprintf(stderr, "Failed to open GLFW window: %s\n", glfwErrorString(glfwGetError())); + + glfwTerminate(); exit(EXIT_FAILURE); } @@ -138,6 +140,8 @@ int main(void) if (!open_window()) { fprintf(stderr, "Failed to open GLFW window: %s\n", glfwErrorString(glfwGetError())); + + glfwTerminate(); exit(EXIT_FAILURE); } diff --git a/tests/reopen.c b/tests/reopen.c index 5d137188..ad8401d8 100644 --- a/tests/reopen.c +++ b/tests/reopen.c @@ -132,7 +132,10 @@ int main(int argc, char** argv) for (;;) { if (!open_window(640, 480, (count & 1) ? GLFW_FULLSCREEN : GLFW_WINDOWED)) + { + glfwTerminate(); exit(EXIT_FAILURE); + } glMatrixMode(GL_PROJECTION); glOrtho(-1.f, 1.f, -1.f, 1.f, 1.f, -1.f); @@ -156,6 +159,8 @@ int main(int argc, char** argv) { close_window(); printf("User closed window\n"); + + glfwTerminate(); exit(EXIT_SUCCESS); } } diff --git a/tests/sharing.c b/tests/sharing.c index 64e61740..2f060484 100644 --- a/tests/sharing.c +++ b/tests/sharing.c @@ -137,6 +137,8 @@ int main(int argc, char** argv) if (!windows[0]) { fprintf(stderr, "Failed to open first GLFW window: %s\n", glfwErrorString(glfwGetError())); + + glfwTerminate(); exit(EXIT_FAILURE); } @@ -149,6 +151,8 @@ int main(int argc, char** argv) if (!windows[1]) { fprintf(stderr, "Failed to open second GLFW window: %s\n", glfwErrorString(glfwGetError())); + + glfwTerminate(); exit(EXIT_FAILURE); } diff --git a/tests/tearing.c b/tests/tearing.c index a8d774a4..a4647096 100644 --- a/tests/tearing.c +++ b/tests/tearing.c @@ -73,9 +73,9 @@ int main(void) window = glfwCreateWindow(0, 0, GLFW_WINDOWED, "", NULL); if (!window) { - glfwTerminate(); - fprintf(stderr, "Failed to open GLFW window: %s\n", glfwErrorString(glfwGetError())); + + glfwTerminate(); exit(EXIT_FAILURE); } diff --git a/tests/title.c b/tests/title.c index c7539033..38535708 100644 --- a/tests/title.c +++ b/tests/title.c @@ -51,6 +51,8 @@ int main(void) if (!window) { fprintf(stderr, "Failed to open GLFW window: %s\n", glfwErrorString(glfwGetError())); + + glfwTerminate(); exit(EXIT_FAILURE); } @@ -66,6 +68,7 @@ int main(void) glfwWaitEvents(); } + glfwTerminate(); exit(EXIT_SUCCESS); } diff --git a/tests/windows.c b/tests/windows.c index 894febeb..ddf67915 100644 --- a/tests/windows.c +++ b/tests/windows.c @@ -60,6 +60,7 @@ int main(void) { fprintf(stderr, "Failed to open GLFW window: %s\n", glfwErrorString(glfwGetError())); + glfwTerminate(); exit(EXIT_FAILURE); }