JDesktop locks up

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

JDesktop locks up

snmvaughan
I put together a small JDesktop-based application which uses NEWT, and I'm finding that that I can consistently lock-up the application on a Windows platform.

The problem occurs when I perform the following steps:
1. Use the mouse to rotate the gears in an internal frame that does not have focus.
2. Use the mouse to rotate the gears in the internal frame which has focus.
3. Request focus on the first internal frame by selecting its title bar.

JDesktopDemo.java
Reply | Threaded
Open this post in threaded view
|

Re: JDesktop locks up

Demoscene Passivist
Administrator
Try adding GLProfile.initSingleton(); before u do anything in ur main method.
Reply | Threaded
Open this post in threaded view
|

Re: JDesktop locks up

snmvaughan
Adding the GLProfile.initSingleton() didn't help.  The problem appears to be occurring somewhere in the native code.  Looking at the thread stack traces, it looks as if the NEWT windows thread is waiting on the AWT thread to change the focus.  Enabling all JOGL debugging also shows that the system is still attempting to render, as I continue to see "SwapBuffers calls: ..." messages.

Name: AWT-EventQueue-0-EDT-Display_Windows_nil
State: WAITING on java.awt.EventQueue$1AWTInvocationLock@6833f2
Total blocked: 232  Total waited: 1,114

Stack trace:
java.lang.Object.wait(Native Method)
java.lang.Object.wait(Object.java:485)
java.awt.EventQueue.invokeAndWait(EventQueue.java:993)
com.jogamp.newt.awt.NewtCanvasAWT$FocusAction.run(NewtCanvasAWT.java:85)
com.jogamp.newt.Window.focusAction(Window.java:316)
com.jogamp.newt.impl.windows.WindowsDisplay.DispatchMessages0(Native Method)
com.jogamp.newt.impl.windows.WindowsDisplay.dispatchMessagesNative(WindowsDisplay.java:73)
com.jogamp.newt.Display.dispatchMessages(Display.java:353)
com.jogamp.newt.Display$2.run(Display.java:196)
com.jogamp.newt.util.EDTUtil$EventDispatchThread.run(EDTUtil.java:212)

----------------------------------

Name: AWT-EventQueue-0
State: RUNNABLE
Total blocked: 25  Total waited: 23

Stack trace:
sun.awt.windows.WComponentPeer._requestFocus(Native Method)
sun.awt.windows.WComponentPeer.requestFocus(WComponentPeer.java:617)
java.awt.Component.requestFocusHelper(Component.java:7412)
java.awt.Component.requestFocusHelper(Component.java:7373)
java.awt.Component.requestFocus(Component.java:7181)
com.jogamp.newt.awt.NewtCanvasAWT.requestFocusAWT(NewtCanvasAWT.java:217)
com.jogamp.newt.awt.NewtCanvasAWT$FocusAction$FocusActionImpl.run(NewtCanvasAWT.java:99)
java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:199)
java.awt.EventQueue.dispatchEvent(EventQueue.java:597)
java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:269)
java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:184)
java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:174)
java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:169)
java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:161)
java.awt.EventDispatchThread.run(EventDispatchThread.java:122)
Reply | Threaded
Open this post in threaded view
|

Re: JDesktop locks up

Demoscene Passivist
Administrator
Hmm ok maybe try to initialize ur stuff from another thread instead of the EDT. So try to remove ur SwingUtilities.invokeLater() call and do ur initalization directly on the main() thread (yes I know this is bad style ).

Also take a look here: http://jogamp.org/wiki/index.php/Jogl_FAQ#What_is_Newt.27s_Threading_Model_for_native_window_events_.3F 
Reply | Threaded
Open this post in threaded view
|

Re: JDesktop locks up

snmvaughan
This post was updated on .
Removal of invokeLater() during initialization has no impact.  The underlying cause seems to be a threading issue when attempting to request focus.
Reply | Threaded
Open this post in threaded view
|

Re: JDesktop locks up

snmvaughan
I've moved to the latest automated build of JOGL, and I'm still seeing the same behavior.
Reply | Threaded
Open this post in threaded view
|

Re: JDesktop locks up

snmvaughan
Further testing indicates:
1. Internal frames do not have to be overlapping to cause the problem.
2. Both the focused internal frame and the internal frame requesting focus have to be NewtCanvasAWT instances for the problem to occur.
3. All requests made through requestFocusAWT() are made on the AWT event dispatch thread as expected.
4. The problem doesn't occur when the internal frame already has focus because the requestFocusHelper doesn't perform any action.  This can be seen by enabling logging of "java.awt.focus.Component".
Reply | Threaded
Open this post in threaded view
|

Re: JDesktop locks up

snmvaughan
Opened Bug 406.