Unter Mac OS X kann SWT Display nicht angezeigt werden
Ich verwende Mac OS X Snow Leopard und möchte über den Aktivator in einem OSGi-Bundle nicht auf das Display zugreifen.
Unten ist die Startmethode für meinen Aktivator:
@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();
}
});
}
Das Aufrufen dieses Codes in einer Windows-Umgebung funktioniert einwandfrei, bei der Bereitstellung unter Mac OS X wird jedoch die folgende Ausgabe angezeigt:
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 . . .
Ich habe das Argument -XstartOnFirstThread VM ohne Glück verwendet. Ich bin auf 64-Bit-Kakao, aber ich habe auch 32-Bit-Kakao ausprobiert.
Beim Anprobieren von Carbon erhalte ich folgenden Fehler:
Invalid memory access of location 00000020 eip=9012337c
Beim Debuggen in der Display-Klasse kann ich feststellen, dass das Array Displays [] nur Nullreferenzen enthält.