Community
Participate
Working Groups
Build Identifier: Build id: M20070212-1330 (Ubuntu version: 3.2.2-5ubuntu2) The purpose is to melt swing and SWT (even if a bad idea, it is sometimes mandatory). The main dialog is a SWT one. After calling the Swing method UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()), many SWT dialogs freeze; for instance, closing a MessageBox illustrates the problem. Some first insights: - a call to UIManager.setLookAndFeel("javax.swing.plaf.metal.MetalLookAndFeel") does NOT create problem; in practice, this javax.swing.UIManagerClass.setLookAndFeel to avoid reflection by instanciating a new javax.swing.plaf.metal.MetalLookAndFeel() - a call to UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()), which in my case resolves to "com.sun.java.swing.plaf.gtk.GTKLookAndFeel", DOES create a problem; in this case javax.swing.UIManagerClass.setLookAndFeel loads the case from the gtk library. Problem found using : - swt-3.5.2-gtk-linux-x86.zip, which comes with libswt-(atk,awt,cairo,pi,-xulrunner[...])-gtk-3557.so - system is linux ubuntu intrepid 8.10 with recent distribution updates - window manager is Gnome 2.24.1 - Reproducible: Always Steps to Reproduce: 1. create a SWT Shell 2. UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()) 3. display a MessageBox; on close, the application hangs
Created attachment 174875 [details] java testcase Add SWT native libraries and Java classes in classpath java -Djava.library.path=<pathToNative> -classpath .:swt.jar test1.TestLock
About the java testcase added: - (1) check that MessageBox behaves without problem before calling UIManage - (2) clic the second button to call UIManager.setLookAndFeel - (3) problem occurs when clicking again the first button for displaying the message box; application freeze when closing the messagebox Problem occurs in my configuration (linux ubuntu intrepid / gtk) with - java-6-sun-1.6.0.14 - java-1.5.0-gcj-4.3-1.5.0.0 No problem observed using java-1.5.0-sun-1.5.0.19 because gtk don't even tries to load the relevant look and feel, and dies with "/usr/share/themes/Human/gtk-2.0/gtkrc:43: error: lexical error or unexpected token, expected valid token", which is a side error without interest at first look.
Similar problem submitted by someone else in another website http://java.itags.org/java-swing/13590/
This problem happens because AWT/Swing initializes GTK threads by calling gdk_threads_init() when the GTK look and feel is used. The lock use by GTK is not reentrant. See bug#280649 for more info. *** This bug has been marked as a duplicate of bug 280649 ***