Problem with removing GLJPanel -> frozen app

Hello,

I am having a recurrent problem, when I want to remove a GLJPanel from its container, it gives me a frozen app!

I already had these kinds of problems (removing glcanvas or gljpanel) with precedent versions of jogl and it is a recurrent problem. I tried the latest version JSR231 1.0.0 and my app becomes frozen when the call to remove is made (but this is not systematic).
I have a panel panelA that contains several panels (panelB, panelC and panelD for instance), and we can say that panelD contains one GLJPanel. When I make a call to panelA.removeAll(), => frozen app!

How can I solve it? Isn’t there a SAFE way to remove a panel that contains a GLJPanel from its container?

Thank you for your help.

Just a guess… maybe this is happening when you are removing GLJPanel while the context is actually rendered. Try to stop animator (or whatever you are using to call canvas.display() method) and then remove GLJPanel, in other word see if AWT and rendering threads synchronization helps…

Bohdan.

One thing you absolutely must do is perform the remove() or removeAll() call from the Event Dispatch Thread (EDT) using the SwingUtilities or EventQueue classes. Double-check to see whether this is the case in your application. If you’re already doing this, and can provide a small and simple test case illustrating the hang, please post it or file a bug using the Issue Tracker on the JOGL home page.

Hello,

my gljpanel isn’t rendered when I want to remove it, it is not associated with an Animator, and juste before removing it, I wrote
gljPanel.setVisible(false);
gljPanel.setEnabled(false);

I tried to use Ken’s method, but I don’t know exactly how to do.
I added (before calling panelA.removeAll()):

    final GLJPanel gljPanel = panelD.getGLJPanel();
    gljPanel.setVisible(false);
    gljPanel.setEnabled(false);
    
    Runnable supprimerGLJPanel = new Runnable() {
        public void run() {
            remove(gljPanel);
        }
    };                
    SwingUtilities.invokeAndWait(supprimerGLJPanel);

and then, when I call panelA.removeAll, I have the following errors :

Exception in thread “Thread-11” javax.media.opengl.GLException: Error releasing pbuffer device context: error code 0
at com.sun.opengl.impl.windows.WindowsPbufferGLDrawable.destroy(WindowsPbufferGLDrawable.java:92)
at com.sun.opengl.impl.GLPbufferImpl.destroy(GLPbufferImpl.java:176)
at javax.media.opengl.GLJPanel.removeNotify(GLJPanel.java:408)
at java.awt.Container.removeNotify(Unknown Source)
at javax.swing.JComponent.removeNotify(Unknown Source)
at java.awt.Container.removeNotify(Unknown Source)
at javax.swing.JComponent.removeNotify(Unknown Source)
at java.awt.Container.removeNotify(Unknown Source)
at javax.swing.JComponent.removeNotify(Unknown Source)
at java.awt.Container.removeNotify(Unknown Source)
at javax.swing.JComponent.removeNotify(Unknown Source)
at java.awt.Container.removeNotify(Unknown Source)
at javax.swing.JComponent.removeNotify(Unknown Source)
at java.awt.Container.removeNotify(Unknown Source)
at javax.swing.JComponent.removeNotify(Unknown Source)
at java.awt.Container.removeAll(Unknown Source)

Is it the good way to use SwingUtilities? I don’t understand why I have problems for removing the gljPanel if I put it to : setVisible(false)…

Please provide a complete and self-contained test case. It’s impossible to figure out what might be going wrong from this description.

Hi,

I made other tests, using the SwingUtilities class, and everything is now OK! I can remove GLJPanel everytime it is necessary without having troubles.

Thank you very much.