Community
Participate
Working Groups
Created attachment 263982 [details] Snippet to reproduce the problem In the attached snippet, a display and shell are created, disposed, and then recreated. This somehow causes a MessageBox.open call to hang, without the message being shown. The hang was seen on Windows 7; in Ubuntu 14.04, the message is shown and then the program exits, as expected. On both operating systems, SWT 4.6 64-bit was used.
(In reply to Nam Quang Tran from comment #0) > Created attachment 263982 [details] > Snippet to reproduce the problem > Unable to reproduce hang issue with attached snippet on Win7
My configuration: - Windows 7 Ultimate SP1 64-Bit - Oracle JDK 1.8.0_101 64-Bit - Eclipse Neon 4.6.0, build ID 20160613-1800 - SWT 4.6 64-Bit. The version.txt inside the SWT jar says "version 4.623". Discovered something interesting: The snippet hangs when run inside Eclipse, but does not hang if I export the test project as a runnable jar and then run the jar from the commandline with "java -jar test.jar". I don't remember having altered my project run configuration in any way.
Tested again with SWT 4.7M1 (version 4.706). Same results.
@Niraj I tried on fedora 24 I am not able to reproduce this.
Perhaps I should add that my Windows copy is running inside a VirtualBox machine. Not sure if that's relevant...
Running the snippet in debug mode with SWT 4.6 reveals that the program is stuck at OS.java:3051, which is the following line: return MessageBoxW (hWnd, lpText1, lpCaption1, uType);
The complete call stack is probably more helpful; here it is: OS.MessageBoxW(long, char[], char[], int) line: not available [native method] OS.MessageBox(long, TCHAR, TCHAR, int) line: 3051 MessageBox.open() line: 206 Test.main(String[]) line: 20
One more piece of information: The snippet was run in a fresh copy of "Eclipse IDE for Java Developers" without any additional plugins.
The second MessageBox does appear, you can Alt+Tab to it. The problem is that the application loses foreground status after the first shell is disposed. The second MessageBox pops up in the background and is hard to notice. I'm not sure about the other platforms, but this behavior is correct on Windows. If the application has no windows, it can't be in the foreground.