Bug: Newt EDT invokeAndWait (from BrickFarmer)

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Bug: Newt EDT invokeAndWait (from BrickFarmer)

Sven Gothel
Administrator
BrickFarmer wrote:
> So using b253 I'm now investigating why I started getting "Cannot call
> invokeAndWait from the event dispatcher thread" from my main thread...

Just not to loose this report within a long email thread.
Please provide a sample so I can reproduce it, thank you.

~Sven
Reply | Threaded
Open this post in threaded view
|

Re: Bug: Newt EDT invokeAndWait (from BrickFarmer)

BrickFarmer
you can replicate this in gears demo, replace the main method with the code below:



  public static void main(String[] args) {

        try {
            SwingUtilities.invokeAndWait(new Runnable() {
                public void run() {

                    final Frame frame = new Frame("Gear Demo");
                    GLCanvas canvas = new GLCanvas();

                    canvas.addGLEventListener(new Gears());
                    frame.add(canvas);
                    frame.setSize(300, 300);
                    final Animator animator = new Animator(canvas);
                    frame.addWindowListener(new WindowAdapter() {
                        public void windowClosing(WindowEvent e) {
                            // Run this on another thread than the AWT event queue to
                            // make sure the call to Animator.stop() completes before
                            // exiting
                            new Thread(new Runnable() {
                                public void run() {
                                    animator.stop();
                                    System.exit(0);
                                }
                            }).start();
                        }
                    });

                    frame.setVisible(true);
                    animator.start();

                }
            });
        } catch (InterruptedException e) {
            e.printStackTrace();
        } catch (InvocationTargetException e) {
            e.printStackTrace();
        }

    }

I'm thinking the change to JAWTUtil (ca1e14eee25536a217d682c66f9ad07d5bdf642e) probably needs wrapping in:
if (!SwingUtilities.isEventDispatchThread()) {
...
}
but that's only based on looking at recent commits...

[edit] btw this is GLCanvas based, not newt
Reply | Threaded
Open this post in threaded view
|

Re: Bug: Newt EDT invokeAndWait (from BrickFarmer)

BrickFarmer
confirm fixed in b255 :)

now I'm only left with the GL_POLYGON_OFFSET_FILL / Depth buffer issue.  I'm going to go back to b220 and see what changed along the way that might affect this.  I suspect it's a precision change, but I'll post back if I track it down.