[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Newsgroup Home]
|
[news.eclipse.platform.swt] Re: Mac OS X 10.5 Leopard SWT symptom/bug?
|
I think you are seeing this bug:
https://bugs.eclipse.org/bugs/show_bug.cgi?id=211167
Apple is working on it.
Hope this helps,
Carolyn
"Dan Hudson" <hoss@xxxxxxxxxxxxxx> wrote in message
news:hoss-FB3F82.08201216112007@xxxxxxxxxxxxxxxxxxx
> In short, I am seeing different behaviour from an eclipse launched java
> app than a command line application... and the challenge is that
> -XstartOnFirstThread behaviour has changed in leopard in a way that
> classloaders (like Hibernate which use
> Thread.currentThread().getContextClassLoader() break.
>
> Cross post from Jens post to see if others see this issue as well.
>
> /dan
>
>
> This pure SWT application seems to work:
> import org.eclipse.swt.widgets.Display;
> import org.eclipse.swt.widgets.Shell;
> import org.eclipse.swt.widgets.Menu;
> import org.eclipse.swt.widgets.MenuItem;
> import org.eclipse.swt.widgets.Label;
> import org.eclipse.swt.SWT;
>
>
> public class HelloWorld {
> private Display display;
> private Shell shell;
>
> public HelloWorld() {
> getClassLoader("before instantiation of first swt object");
> setUpDisplay();
> getClassLoader("after instantiation of swt objects");
> createLabel();
> createMenuBar();
> revealDisplay();
>
> }
>
> private void setUpDisplay() {
> display = new Display();
> shell = new Shell(display);
> shell.setSize(200, 100);
> shell.setText("SWTGreeter");
> }
>
> private void createMenuBar() {
> Menu menu = new Menu(shell, SWT.BAR);
> shell.setMenuBar(menu);
> MenuItem fileMenuItem = new MenuItem(menu, SWT.CASCADE);
> fileMenuItem.setText("File");
> MenuItem editMenuItem = new MenuItem(menu, SWT.CASCADE);
> editMenuItem.setText("Edit");
> }
>
> private void createLabel() {
> Label label = new Label(shell, SWT.CENTER);
> label.setText("Hello SWT");
> label.setBounds(shell.getClientArea());
> }
>
> private void revealDisplay() {
> shell.open();
> while (!shell.isDisposed()) {
> if (!display.readAndDispatch())
> display.sleep();
> }
> display.dispose();
> }
>
> private void getClassLoader(String loc) {
> ClassLoader cl = Thread.currentThread().getContextClassLoader();
> System.out.println(loc+": classloader resolvable? "+(cl!=null));
> }
>
> public static void main(String[] args) {
> ClassLoader cl = Thread.currentThread().getContextClassLoader();
> System.out.println("classloader from static main resolvable? " +
> (cl != null));
> new HelloWorld();
>
> }
> }
>
> responding when run within eclipse:
> classloader from static main resolvable? false
> before instantiation of first swt object: classloader resolvable? false
> after instantiation of swt objects: classloader resolvable? false
> Invalid memory access of location 00000000 eip=0045c2ab
>
> knowing of course that SWT is an older version:
> org.eclipse.swt.carbon.macosx_3.3.2.v3347a.jar
>
> and responding when run at the commandline:
> Montana:~/Documents/workspace/swt_test$ ./run.sh
> launching HelloWorld with
> ./bin:./libswt/org.eclipse.swt_3.3.2.v3347.jar:./libswt/org.eclipse.swt.c
> arbon.macosx_3.3.2.v3347a.jar SWT from eclipse/Resources/MacOSX...
> java -cp
> ./bin:./libswt/org.eclipse.swt_3.3.2.v3347.jar:./libswt/org.eclipse.swt.c
> arbon.macosx_3.3.2.v3347a.jar HelloWorld
> classloader from static main resolvable? true
> before instantiation of first swt object: classloader resolvable? true
> ./run.sh: line 5: 3743 Segmentation fault java -cp $CLASSPATH
> HelloWorld
>
> now try with latest swt daily (11/17)
>
> launching HelloWorld with ./bin:./swt-3/swt.jar
> java -cp ./bin:./swt-3/swt.jar HelloWorld
> classloader from static main resolvable? true
> before instantiation of first swt object: classloader resolvable? true
> ./run.sh: line 11: 3745 Segmentation fault java -cp $CLASSPATH
> HelloWorld
>
> launching with startOnFirstThread
> java -XstartOnFirstThread -cp ./bin:./swt-3/swt.jar HelloWorld
> classloader from static main resolvable? false
> before instantiation of first swt object: classloader resolvable? false
> after instantiation of swt objects: classloader resolvable? false
> Invalid memory access of location 00000000 eip=0045c2ab
> ./run.sh: line 14: 3748 Bus error java
> -XstartOnFirstThread -cp $CLASSPATH HelloWorld
>
> In summary:
> when SWT works (the third launch), the root classloader doesn't.