currently, glfwInit crashes natively if -XstartOnFirstThread. it would be nice if one could catch this more gracefully e.g. by checking if -XstartOnFirstThread is set (similarly to glfwCreateWindow), and throwing an exception if not.
Quote from: arisona on March 31, 2016, 10:14:01
currently, glfwInit crashes natively if -XstartOnFirstThread.
Really? That's very odd, because on OS X you are
required to use
-XstartOnFirstThread, otherwise LWJGL would complain with a:
IllegalStateException: Please run the JVM with -XstartOnFirstThread and make sure a window toolkit other than GLFW (e.g. AWT or JavaFX) is not initialized.
Yes, that's how I remembered it.
Now (3.0.0-SNAPSHOT) I'm calling glwfInit() basically as the first thing in my code, and will then eventually open a window.
GLFW.glfwInit() basically is
public static int glfwInit() {
long __functionAddress = Functions.Init;
return invokeI(__functionAddress);
}
without any checks, while GLFW.createWindow does
EventLoop.OffScreen.check();
... unless I'm missing something here.
Ah... you mean that glfwInit() crashes if -XstartOnFirstThread is not specified as VM argument.
So your "glfwInit crashes natively if -XstartOnFirstThread.", actually means: "glfwInit crashes natively if -XstartOnFirstThread was not set/omitted as VM argument"
yes, sorry, my bad i should have read it again before posting
yes, it crashes if -XstartOnFirstThread is *not* set.
I found the problem, the thread check is effectively disabled by default. It will be fixed in the next nightly build.
I can't reproduce a crash on glfwInit though, that's why it doesn't even have the check. Are you sure it crashes for you on glfwInit and not on glfwCreateWindow?
actually correct, it's not glfwInit(), but glfwCreateWindow()
Thanks, fixed in nightly build #63.
Thank you - works as expected now.