glfwTerminate() problem

liamstask wrote on Friday, October 05, 2012:

Hello! I’m maintaining an application developed with glfw 2.7.2 and am trying
to upgrade to 2.7.6.

On OS X, I see that glfw_atexit() is called on a thread that is not the
main thread, and segfaults during glfwTerminate() - there’s a comment in
cocoa_init.m _glfwPlatformTerminate() that says “fail unless this is the
main thread”…if I insert a check for the main thread there and return
GL_FALSE, all goes according to plan.

Alternatively, if I call glfwTerminate() myself on the main thread and
disable glfw_atexit(), everything works.

Is this a known issue, or does this possibly indicate some other step I need
to take in upgrading from 2.7.2 to 2.7.6? Obviously there are a couple
workarounds, but each require editing glfw source, which I’d prefer to avoid
if possible :slight_smile:


liamstask wrote on Friday, October 05, 2012:

Ah, nevermind. I see this was already manually edited out of the glfw sources
in the previous version of my app as well.

In any event, it would be nice to be able to optionally disable the
installation of the atexit handler.

Thanks :slight_smile:

elmindreda wrote on Sunday, October 07, 2012:

That’s a bug in GLFW 2.7.6. Thank you for finding it!

The other ports already have this check. I’ve added the check to the OS X port
as well. The fix will be included in GLFW 2.7.7, or you can get it right away
from Subversion (although your local fix is likely just as good).