One of our mac users has recently been helping troubleshoot issues that we've had with our macOS package. They identified two situations where creating and/or destroying a GLJPanel in close proximity to other AWT/Swing-ish commands will cause the application to hang with, so far, no known error messages.
The test system in question is running Big Sur with OpenJDK-17.0.1
These are distilled-down versions. If the code looks odd, it's because we have clipped out all the application-specific context for why these operations are done in this order.
We speculate that there may be a timing component because wrapping some of the operations in nested SwingUtilities.invokeLater() will allow the application to proceed without hanging.
import com.jogamp.opengl.awt.GLJPanel;
import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.SwingUtilities;
public class MaximizeTest2 {
JFrame f;
GLJPanel canvas;
JPanel p;
public MaximizeTest2() {
newWindow();
}
public void newWindow() {
SwingUtilities.invokeLater(new Runnable() {
@Override
public void run() {
f = new JFrame("test frame maximized both ");
f.setExtendedState(JFrame.MAXIMIZED_BOTH); //This call is about the only thing that reliably
f.setVisible(true); //triggers this behavior, but it actually came
//up in the real application
p = new JPanel();
canvas = new GLJPanel();
//p.add(canvas); //Note: It does not seem to matter if canvas is added to the panel or not.
f.setContentPane(p);
f.validate();
System.out.println("yyyy");
}
});
}
public static void main(String[] args) {
// TODO code application logic here
System.out.println("xxxx");
new MaximizeTest2();
System.out.println("zzzz");
}
}
Reproduced with the following JDK on MacOS
Azul JDK 17 for ARM
OpenJDK 17 (Rosetta might be involved to run on ARM)
Initially discussed here.
Reproduced with the following JDK on MacOS