Fix example code in README.md#12
Conversation
Fixed example codes: Add glfw.destroy_window(window) to last line.
|
Hi, please try the latest commit to see if it fixes the problem you are encountering. |
|
Still experiencing freezes on shutdown. Does this issue only occur in my environment? |
|
What platform are you running it on? |
|
Windows 11 x64 |
|
I see. I'm using GNU/Linux (Ubuntu) and I've never experienced this problem. So, yes, it looks like a system-related issue. |
|
Yes, all of them have freezing issues except version.lua and simple.lua.
|
|
And of course, when I remove glfw.destroy_window(window), simple.lua also freezes when quitting. |
|
simple.lua is an almost verbatim translation from C to Lua of an original GLFW example. I just left the destroy_windows() call as in the original, but it is not essential. Or at least, it should not be... The idea is that the explicit destruction of objects can be omitted when the program is exiting. This is especially useful when the exit is caused by a scripting error. You can easily test this scenario by adding a call to a non-existing function (e.g. foo()) before the glfw.destroy_window() call. On your system, this would most likely cause the program to freeze and the explicit call to destroy_window() would be no cure in this case. I have to do some thinking on how to tackle this problem, which looks a bit strange to me and may have to do with how windows and msys2 handle the atexit() code. I'll turn this pull request in an open issue. |
Add glfw.destroy_window(window) to last line.
Without that, the program halts when exiting.