miquelmartin / Siafu

Siafu Simulator
http://siafusimulator.org
11 stars 8 forks source link

Siafu cannot be runned on Mac Os X #2

Closed lpellegr closed 12 years ago

lpellegr commented 12 years ago

I compiled and packaged the latest version from the trunk but it cannot be runned on Mac Os X 10.7.4

I get the following stacktrace:

./runOSX64.sh 
Using configuration at /Users/lpellegr/.Siafu/config.xml
Creating the command listener.
Listening for external commands.
Starting Siafu...
***WARNING: Display must be created on main thread due to Cocoa restrictions.
Exception in thread "GUI thread" org.eclipse.swt.SWTException: Invalid thread access
    at org.eclipse.swt.SWT.error(Unknown Source)
    at org.eclipse.swt.SWT.error(Unknown Source)
    at org.eclipse.swt.SWT.error(Unknown Source)
    at org.eclipse.swt.widgets.Display.error(Unknown Source)
    at org.eclipse.swt.widgets.Display.createDisplay(Unknown Source)
    at org.eclipse.swt.widgets.Display.create(Unknown Source)
    at org.eclipse.swt.graphics.Device.<init>(Unknown Source)
    at org.eclipse.swt.widgets.Display.<init>(Unknown Source)
    at org.eclipse.swt.widgets.Display.<init>(Unknown Source)
    at de.nec.nle.siafu.graphics.GUI.run(Unknown Source)
    at java.lang.Thread.run(Thread.java:722) 
nfvs commented 12 years ago

Possible solution? Apparently Edward Thompson's workaround fixes it. A code change is needed though.

http://stackoverflow.com/questions/7395994/why-do-we-still-get-swt-invalid-thread-access-exception-on-mac-with-xstartonfir

miquelmartin commented 12 years ago

Strange enough, @phstudy fix works for me in eclipse, but it's not running from the command line. Also, an NPE is coming out of nowhere. It's late, will work on this tomorrow. If you are up for it, do make a pull request with your version, please!

miquelmartin commented 12 years ago

This is still problematic in OS X

miquelmartin commented 12 years ago

Allright, this actually runs from the console if you run it as java -XstartOnFirstThread -jar Siafu.jar. We need to update the startup scripts...

miquelmartin commented 12 years ago

Allright, the master branch (And devel, of course) will now drop OS X, linux and windows scripts to start Siafu in each of those platforms. For most of them starting is a matter of running the jar, but in the case of OSX, that pesky startOnFirstThread was needed