question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[Substance] Showing JColorChooser dialog crashes JVM

See original GitHub issue

Version 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

  1. Load a Substance L&F (I tried both Graphite and Raven).
  2. 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:

substance-color-chooser-dialog-openjdk

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:closed
  • Created 5 years ago
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
kirill-grouchnikovcommented, Nov 18, 2018

The workaround is to call SubstanceCortex.GlobalScope.setUseDefaultColorChooser()

0reactions
kirill-grouchnikovcommented, Nov 18, 2018

This should be fixed now. Thanks for testing on multiple configurations.

Read more comments on GitHub >

github_iconTop Results From Across the Web

JFileChooser crashes JVM - bug basically ignored. What can I ...
Any JFileChooser used for a file open dialog... click the button to go to details view. Start clicking on column headings. JVM crashes...
Read more >
1/10 times java crashes on JFileChooser.showOpenDialog
The user then opens a dialog, possibly on a network drive, this loads some additional OS resources (perhaps DLLs), and then the JVM...
Read more >
JDK-8041519 JVM crash on second DnD after modal ... - Bug ID
importData(). Attempting to perform another drag operation over the Swing program's window while the modal dialog is open and then closing the modal...
Read more >
App crashes when showing a Dialog · Issue #444 - GitHub
It only seems to happen when the dialog state changes - it works if showing the dialog on the first composition, but crashes...
Read more >
191523 – FileDialog crashes JVM - Bugs - Eclipse
I'm attaching code that shows a PopupDialog successfully creating a ElementListSelectionDialog, but crashing the JVM when attempting to create a FileDialog.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found