ashbb/purple_shoes — Issue #1: `SWTException: Invalid thread access` on OSX
Author: phinze
Created: 2012-01-28 22:32:05+00:00
State: open

Hey ashbb!

Cool stuff you got going on here! I've just stopped by to report my experience testing this on OSX 10.7.

Here's what I did to get things started, rvm style.

```bash
git clone https://github.com/ashbb/purple_shoes.git
cd purple_shoes
echo "rvm jruby@purple_shoes --create" > .rvmrc
cd . # get rvm to pick up rvmrc and create gemset
gem install swt
cd samples/
jruby --1.9 sample.rb
```
And here's the output I get:

```
objc[18116]: Object 0x7fbc9203c8c0 of class __NSArrayM autoreleased with no pool in place - just leaking - break on objc_autoreleaseNoPool() to debug
***WARNING: Display must be created on main thread due to Cocoa restrictions.
NativeException: org.eclipse.swt.SWTException: Invalid thread access
app at /Users/phinze/dev/purple_shoes/lib/shoes/main.rb:15
(root) at sample1.rb:6
```

Googling for "Display must be created on main thread due to Cocoa restrictions.", I found recommendations to try adding `-XstartOnFirstThread` as a JVM arg. I tried sticking this onto the jruby arguments--as it seems to have support for `-X` options--but I got the exact same output.

The SWT FAQ does have an entry on this exception, though I haven't yet delved deep enough to figure out how that answer might apply here:

http://www.eclipse.org/swt/faq.php#uithread

So there's a bit of OSX testing for you. Sorry I couldn't report better news! Hopefully we can figure out what's going on here and it'll be smooth sailing after that.