GLFW.glfwPollEvents() freezes on Mac


I’m using LWJGL 3.1.6, and on the mac, GLFW freezes on glfwPollEvents(). The LWJGL HelloWorld example seems to work fine, and I don’t think my application is doing anything very different from that example. I’ve tried removing all my callback handlers with no luck.
It works on Windows. Does anybody have any tips for debugging this? Perhaps gotchas I should look for that could cause glfwPollEvents to hang?


One thing to check as noted in the docs for glfwPollEvents is to ensure you are calling this from the main thread and not in a callback.


debugging, it seems like we are on the main thread when it’s called, and it’s definitely not called in a glfw callback.
We’re adding the VM option: -XstartOnFirstThread

Are there any other vm options we need to consider?


Ok, that took forever, but I found it!

If I ever call Toolkit.getDefaultToolkit().systemClipboard anywhere, the next poll events would hang (only on Mac).

So I’ve got some studying to do. Anybody have any insights why this is?


I don’t know enough Java to be familiar with why this would be. Are you able to debug the glfwPollEvents() function C code with XCode at all?