Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Invoking JFileChooser with FlatLaF crashes VM (only with Java 17 32bit) #403

Closed
WLenhard opened this issue Oct 26, 2021 · 9 comments
Closed
Labels
JDK bug there is something wrong in the JDK
Milestone

Comments

@WLenhard
Copy link

WLenhard commented Oct 26, 2021

With the latests Adoptium Release (jdk-17+35), installing FlatLaF and invoking a JFileChooser leads to fatal crash of the VM. It did not happen with jdk-16 and I am not sure, if this is a problem with FlatLaF or Adoptium. OS: Win10 Enterprise 19042.1288

Minimal reproducible example:


import javax.swing.JFileChooser;
import javax.swing.SwingUtilities;
import com.formdev.flatlaf.FlatLightLaf;

public class FileChooserTest {
public static void main(String[] args) {
	
	FlatLightLaf.setup();
	
	SwingUtilities.invokeLater(new Runnable() {
		@Override
		public void run() {
			try {
				JFileChooser chooser = new JFileChooser();
				chooser.showSaveDialog(null);
				String file = chooser.getSelectedFile().getName();
				System.out.println(file);
			} catch (Exception e) {
				e.printStackTrace();
			}

		}
	});
}
}

@Bios-Marcel
Copy link
Contributor

You should always post the exception, in case something isn't reproducable for some reason. Also, you have to use three backticks at the start and top of your code 👍

@WLenhard
Copy link
Author

WLenhard commented Oct 26, 2021

Thanks Marcel. There is no Exception. The VM crashes and creates a log:
"An unrecoverable stack overflow has occurred.
A fatal error has been detected by the Java Runtime Environment:
EXCEPTION_STACK_OVERFLOW (0xc00000fd) at pc=0x5e141119, pid=11772, tid=12752

JRE version: OpenJDK Runtime Environment Temurin-17+35 (17.0+35) (build 17+35)
Java VM: OpenJDK Client VM Temurin-17+35 (17+35, mixed mode, emulated-client, serial gc, windows-x86)
Problematic frame:
C [awt.dll+0xd1119]

No core dump will be written. Minidumps are not enabled by default on client versions of Windows

An error report file with more information is saved as:
... \hs_err_pid11772.log"

@DevCharly
Copy link
Collaborator

Hmm, does not crash here (Win 10; Temurin 17+35)...

Does it crash too if you use Metal or Windows L&F?
Does it also crash if you try it on another computer?

Could you post hs_err_pid11772.log here or email it to me? [email protected]

@WLenhard
Copy link
Author

I tried with the nightly build 17.0.1, which will be published this week. There, the crash does not occur, so it seemingly is already solved (-> adoptium/adoptium-support#385 ) or it might be related to the 32bit VM. Additionally, the crash does not happen with Metal L&F. While the problem might already be solved, I will send the log via mail. Probably it is still helpful.

@WLenhard
Copy link
Author

WLenhard commented Nov 5, 2021

Hi Charly,
I checked with the new JRE17.0.1+12 and can now trace back the error a little bit better. The error still occurs, but only in the x86 runtime and not in x64 on Windows. The runtime crashes when opening a JFileChooser. Other Swing components seem to work fine.

Best regards!

Edit: I used FlatLaF 1.6.1, but it occurs in 1.5 as well - as already stated only with x86 VMs.

@WLenhard WLenhard reopened this Nov 5, 2021
@DevCharly
Copy link
Collaborator

Can reproduce it.
It is not related to FlatLaf.
Occurs also in Windows L&F.
Metal L&F works because it does not show system icons.

It is a bug in OpenJDK when accessing system icons for the file chooser.
Occurs also in Windows L&F. Metal L&F does not show system icons.

There was a change in this area in JDK 17 to access "large Windows icons", which may be responsible for this crash.
See: https://bugs.openjdk.java.net/browse/JDK-8182043

Maybe this change was never tested on 32 Bit because Oracle distributes only 64 Bit JDKs?

@DevCharly
Copy link
Collaborator

To avoid the crash I've implemented an workaround, which simply does not use Windows system icons on 32bit Java 17...

64-bit Java 17 is not affected.

@DevCharly DevCharly added this to the 2.0 milestone Nov 5, 2021
@DevCharly DevCharly added the JDK bug there is something wrong in the JDK label Nov 5, 2021
DevCharly added a commit that referenced this issue Nov 11, 2021
@DevCharly
Copy link
Collaborator

Workaround is in 1.6.2.

@DevCharly DevCharly modified the milestones: 2.0, 1.6.2 Nov 11, 2021
DevCharly added a commit that referenced this issue Dec 31, 2021
@DevCharly DevCharly changed the title Invoking JFileChooser with FlatLaF crashes VM Invoking JFileChooser with FlatLaF crashes VM (only with Java 17 32bit) Dec 31, 2021
@DevCharly
Copy link
Collaborator

related JDK bug: https://bugs.openjdk.java.net/browse/JDK-8277299

Fixed in Java 18 EA 32bit

I've updated the FlatLaf workaround to show Windows system icons again in Java 18+ 32bit.
So only Java 17 32bit does not show Windows system icons in file chooser tree/table.

DevCharly added a commit that referenced this issue Aug 7, 2023
…va 17 64-bit is not affected. (regression since FlatLaf 2.3; PR #522, see also issue #403)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
JDK bug there is something wrong in the JDK
Projects
None yet
Development

No branches or pull requests

3 participants