Should glfwDestroyWindow always be called?
Asked Answered
F

1

6

I've recently found GLFW and have been trying out making a simple application with it and was wondering about glfwTerminate and glfwDestroyWindow. I understand that glfwTerminate will cleanup any windows that are still open so it should be safe to never call gflwDestroyWindow on the main window but should I still call gflwDestroyWindow before terminating or is it more just a personal preference?

To clarify which of the following are "better".

auto window = glfwCreateWindow(...);
// Do some things
glfwDestroyWindow(window);
glfwTerminate();

Or

auto window = glfwCreateWindow(...);
// Do some things
glfwTerminate();
Filomenafiloplume answered 8/10, 2015 at 20:26 Comment(0)
D
8

According to documentation

All windows remaining when glfwTerminate is called are destroyed as well.

you don't need to do call glfwDestroyWindow(window);. Although I suppose it is better to destroy each window separately.

Dingess answered 8/10, 2015 at 20:30 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.