[Substance] Showing JColorChooser dialog crashes JVM
See original GitHub issueVersion of Radiance (current development is 1.5-SNAPSHOT)
1.0.2
Sub-project (Neon, Trident, Substance, Flamingo, …)
Substance
Version of Java (current minimum is 8)
Oracle Java SE 1.8.0_191
$ $JAVA_HOME/bin/java -version
java version "1.8.0_191"
Java(TM) SE Runtime Environment (build 1.8.0_191-b12)
Java HotSpot(TM) 64-Bit Server VM (build 25.191-b12, mixed mode)
Version of OS
Fedora 28 x86_64 (GNOME 3.28.2)
$ uname -a
Linux localhost.localdomain 4.18.16-200.fc28.x86_64 #1 SMP Sat Oct 20 23:53:47 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux
The issue you’re experiencing (expected vs actual, screenshot, stack trace etc)
Calling JColorChooser#showDialog()
with a Substance L&F active crashes the JVM.
Reproduction steps
- Load a Substance L&F (I tried both Graphite and Raven).
- Call
JColorChooser#showDialog()
.
Expected behavior
The color chooser dialog should be displayed.
Actual behavior
The JVM crashes (see log).
Additional information
I created an MCVE to demonstrate this issue. The actual code to trigger the crash is pretty straightforward:
public static void main(final String[] args) throws Exception {
SwingUtilities.invokeAndWait(() -> {
try {
// commenting out the next line will prevent the JVM crash
UIManager.setLookAndFeel("org.pushingpixels.substance.api.skin.SubstanceGraphiteLookAndFeel");
JColorChooser.showDialog(null, "Choose Color", Color.BLACK);
} catch (final Exception e) {
e.printStackTrace();
}
});
}
As the comment suggests, using the default L&F (Nimbus in my case), produces the expected behavior.
Substance 1.5-SNAPSHOT
The same actual behavior occurs when I use Substance 1.5-SNAPSHOT.
OpenJDK JRE on Linux
If I build and run the MCVE using OpenJDK JRE 1.8.0_181, the JVM does not crash, and the color chooser dialog is displayed. However, the resulting dialog appears to be frozen and does not respond to any user input:
Oracle JRE on Windows
When running the Oracle-JDK-built MCVE artifact on a Windows x86_64 box with Oracle JRE 1.8.0_191, the color chooser dialog is shown and behaves as expected.
Final thoughts
I realize there may be a legitimate Linux-specific JVM bug that needs to be fixed here because the JVM should never crash. However, my guess is it would be easier for the Radiance team to report this bug as it seems to be triggered by something Substance is doing.
If there is a Substance-specific change that could be deployed (or some workaround I could employ from application code) to mask the JVM issue, it would be greatly appreciated.
Issue Analytics
- State:
- Created 5 years ago
- Comments:5 (3 by maintainers)
Top GitHub Comments
The workaround is to call
SubstanceCortex.GlobalScope.setUseDefaultColorChooser()
This should be fixed now. Thanks for testing on multiple configurations.