title: Can't get SWT Display on Mac OS X
body: <p>I'm running Mac OS X Snow Leopard and wan't to access the Display from the activator in an OSGi bundle. </p>
  
  <p>Below is the start method for my activator:</p>
  
  <pre><code>@Override
  public void start(BundleContext context) throws Exception {
      ExecutorService service = Executors.newSingleThreadExecutor();
      service.execute(new Runnable() {
  
          @Override
          public void run() {
              Display display = Display.getDefault();
              Shell shell = new Shell(display);
              Text helloText = new Text(shell, SWT.CENTER);
              helloText.setText("Hello SWT!");
              helloText.pack();
              shell.pack();
              shell.open();
              while (!shell.isDisposed()) {
                  if (!display.readAndDispatch())
                      display.sleep();
              }
              display.dispose();
          }
      });
  }
  </code></pre>
  
  <p>Calling this code in a Windows environment works fine, but deploying on Mac OS X I get the following output: </p>
  
  <pre>
  2009-10-14 17:17:54.050 java[2010:10003] *** __NSAutoreleaseNoPool(): Object 0x101620d20 of class NSCFString autoreleased with no pool in place - just leaking
  2009-10-14 17:17:54.081 java[2010:10003] *** __NSAutoreleaseNoPool(): Object 0x100119240 of class NSCFNumber autoreleased with no pool in place - just leaking
  2009-10-14 17:17:54.084 java[2010:10003] *** __NSAutoreleaseNoPool(): Object 0x1001024b0 of class NSCFString autoreleased with no pool in place - just leaking
  2009-10-14 17:17:54.086 java[2010:10003] *** __NSAutoreleaseNoPool(): Object 0x7fff701d7f70 of class NSCFString autoreleased with no pool in place - just leaking
  2009-10-14 17:17:54.087 java[2010:10003] *** __NSAutoreleaseNoPool(): Object 0x100113330 of class NSCFString autoreleased with no pool in place - just leaking
  2009-10-14 17:17:54.092 java[2010:10003] *** __NSAutoreleaseNoPool(): Object 0x101624540 of class NSCFData autoreleased with no pool in place - just leaking
  .
  .
  .
  </pre>
  
  <p>I've used the -XstartOnFirstThread VM argument without any luck. I'm on 64-bit Cocoa but I've also tried 32-bit Cocoa.</p>
  
  <p>When trying on Carbon I get the following error:</p>
  
  <pre>
  Invalid memory access of location 00000020 eip=9012337c
  </pre>
  
  <p>When debugging into the Display class I can see that the Displays[] array only contains null references.</p>