| Summary: | Setting GTK Look and Feel causes window to freeze when closed. | ||
|---|---|---|---|
| Product: | [Eclipse Project] Platform | Reporter: | Ken Keefe <kjkeefe> |
| Component: | SWT | Assignee: | Silenio Quarti <Silenio_Quarti> |
| Status: | RESOLVED FIXED | QA Contact: | |
| Severity: | critical | ||
| Priority: | P3 | CC: | pwebster, remy.suen, Silenio_Quarti, sxenos |
| Version: | 4.1 | ||
| Target Milestone: | --- | ||
| Hardware: | PC | ||
| OS: | Linux | ||
| Whiteboard: | |||
May be related to bug 320524. Do you open a MessageBox (or some other dialog) when exiting your RCP app? If so, this i a dup of bug#280649. No, I don't think this is a duplicate. Take a look at the steps to reproduce this bug. It uses only the code from the Hello World RCP template and this call: UIManager.getSystemLookAndFeelClassName() I think this must be a problem with GTK and the RCP code. I was unable to reproduce this bug using just SWT. Sorry, this is the call I should have pasted: UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); Yes, this is a slightly different manifestion of bug#280649. The root cause of this problem is the fact that AWT/Swing is initializing GTK threads (gdk_threads_init()) when the GTK L&F is used. I released a workaround that avoids this deadlock as well, but the complete solution requires changes in both toolkits (see bug#341799). Fixed > 20110407. (In reply to comment #5) > Yes, this is a slightly different manifestion of bug#280649. The root cause of > this problem is the fact that AWT/Swing is initializing GTK threads > (gdk_threads_init()) when the GTK L&F is used. I released a workaround that > avoids this deadlock as well, but the complete solution requires changes in > both toolkits (see bug#341799). > > Fixed > 20110407. Is the workaround described in bug#280649 (I can't seem to access this bug), bug#341799, or somewhere else? Thanks very much for letting me know what the problem is. The workaround for this bug is to call gdk_threads_leave() before SWT calls g_main_context_iteration() in Display.readAndDispatch(). You should be able to see bug#280649 now. This bug appears to have been the cause of bug 354842. |
Build Identifier: M20110210-1200 I'm using Ubuntu 10.04 64-bit. I've tested my application on Windows and OSX and it is not experiencing a similar problem. I'm developing an RCP application that uses SWING components (for legacy reasons). I just recently came across this problem, but I'm not sure if it is new. When I set the look and feel for SWING using: try { UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); } catch (Exception e) { System.out.println(e); } And run my application, it behaves normally. But when I click the X button in the corner of my main window, the application just freezes. I can't seem to get any sort of debugging information on this error, it just freezes until the window manager asks if it should be killed. Also, if I set the look and feel to something other than the GTK one (for example, motif), this problem does not occur. Only when the GTK LaF is used. Finally, I tried to see if I could reproduce this problem using only SWT with the following code and the problem did NOT occur. I was able to reproduce the problem in a simple test case that I describe in the Steps to Reproduce. import javax.swing.UIManager; import org.eclipse.swt.widgets.Display; import org.eclipse.swt.widgets.Shell; public class Main { public static void main(String[] args) { try { UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); } catch (Exception e) { System.out.println(e); } Display display = new Display(); Shell shell = new Shell(display); shell.setText("Hello, world!"); shell.open(); // Set up the event loop. while (!shell.isDisposed()) { if (!display.readAndDispatch()) { // If no more entries in event queue display.sleep(); } } display.dispose(); } } Reproducible: Always Steps to Reproduce: 1. Create a new RCP application and use the Hello World template. 2. Do either 2a OR 2b. 2a. Add this code to the beginning of the Application.start method: try { UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); } catch (Exception e) { System.out.println(e); } // Template code below... Display display.... 2b. In the run configuration, add this to the VM Arguments: -Dswing.defaultlaf=com.sun.java.swing.plaf.gtk.GTKLookAndFeel 3. Run the Hello World application. 4. Click the X button in the corner of the window and it should be frozen now.