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

Interference/timing(?) issue on macOS when creating and destroying GLCanvas #10

Open
jzy3d opened this issue Dec 8, 2021 · 0 comments
Labels
bug Something isn't working macOS

Comments

@jzy3d
Copy link
Owner

jzy3d commented Dec 8, 2021

Initially discussed here.

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)
  • OpenJDK 11 (Rosetta as well)
@jzy3d jzy3d added bug Something isn't working macOS labels Dec 8, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working macOS
Projects
None yet
Development

No branches or pull requests

1 participant