Bug 739 - NativeWindowException with SWT/Ubuntu
Summary: NativeWindowException with SWT/Ubuntu
Alias: None
Product: Jogl
Classification: JogAmp
Component: x11 (show other bugs)
Version: 2.4.0
Hardware: pc_x86_64 linux
: --- major
Assignee: Petros Koutsolampros
Depends on:
Blocks: 674
  Show dependency treegraph
Reported: 2013-05-21 21:38 CEST by Stephen Ranger
Modified: 2020-01-13 17:43 CET (History)
2 users (show)

See Also:
SCM Refs:
Workaround: ---

JOGL-SWT Test Application (4.79 KB, application/octet-stream)
2013-05-21 21:40 CEST, Stephen Ranger

Note You need to log in before you can comment on or make changes to this bug.
Description Stephen Ranger 2013-05-21 21:38:44 CEST
When creating a GLCanvas in SWT or an AWT GLCanvas wrapped in a SWT_AWT created Frame, resizing the window causes the 3D contents to flicker between the original size and the full size and the components' background color. Also, if I move the SWT Shell to my secondary display and full screen it, a "JavaEmbeddedFrame" is created on my primary display containing the 3D canvas (which still flickers).

I have Ubuntu 13.04 with an AMD Radeon 7970 GHz edition and a co-worker that uses Ubuntu 12.04 with an nVidia card. We are both having the same issues. Another co-worker with debian has no issues. No issues on our Windows machines, either. I have fglrx-updates version 9.012 installed and have tested the test program with Java 6 and 7. 

I wrote up a small test case using just jogl, swt, and java (none of our jogl-based libraries) as well as tested the swt.GLCanvas variant (same issues). Included is the SWT version I'm using (I've also tried 3.7) as well as the JOGL version (just downloaded). It's an eclipse project so you should be able to import it directly (libraries might need updating in the build path settings if you're not using x64 linux).

I get this output when application starts

   libEGL warning: DRI2: failed to authenticate

when I fullscreen it on my secondary monitor

   (SWT:10897): Gtk-CRITICAL **: IA__gtk_widget_set_size_request: assertion `GTK_IS_WIDGET (widget)' failed"

when I close the swt Shell and dispose of the display

   (SWT:11308): GLib-GObject-CRITICAL **: g_object_get_qdata: assertion `G_IS_OBJECT (object)' failed
   X11Util.Display: Shutdown (JVM shutdown: true, open (no close attempt): 1/1, reusable (open, marked uncloseable): 2, pending (open in creation order): 3)
   X11Util: Open X11 Display Connections: 1
   X11Util: Open[0]: NamedX11Display[:0, 0x7fe12c646ad0, refCount 1, unCloseable true]
   X11Util.closePendingDisplayConnections(): Closed 3 pending display connections

At one point I received the following stack trace; I can't seem to reproduce it, though

   Caused by: javax.media.nativewindow.NativeWindowException: Unable to lock surface
	at jogamp.nativewindow.jawt.x11.X11JAWTWindow.lockSurfaceImpl(X11JAWTWindow.java:85)
	at com.jogamp.nativewindow.awt.JAWTWindow.lockSurface(JAWTWindow.java:314)
	at jogamp.opengl.GLDrawableImpl.lockSurface(GLDrawableImpl.java:236)
	at jogamp.opengl.GLDrawableImpl.setRealized(GLDrawableImpl.java:156)
	at javax.media.opengl.awt.GLCanvas$2.run(GLCanvas.java:577)
	at jogamp.common.awt.AWTEDTExecutor.invoke(AWTEDTExecutor.java:49)
	at javax.media.opengl.awt.GLCanvas.validateGLDrawable(GLCanvas.java:563)
	at javax.media.opengl.awt.GLCanvas.access$500(GLCanvas.java:141)
	at javax.media.opengl.awt.GLCanvas$9.run(GLCanvas.java:963)
	at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:241)
	at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:727)
	at java.awt.EventQueue.access$200(EventQueue.java:103)
	at java.awt.EventQueue$3.run(EventQueue.java:688)
	at java.awt.EventQueue$3.run(EventQueue.java:686)
	at java.security.AccessController.doPrivileged(Native Method)
	at java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDomain.java:76)
	at java.awt.EventQueue.dispatchEvent(EventQueue.java:697)
	at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:242)
	at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:161)
	at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:150)
	at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:146)
	at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:138)
	at java.awt.EventDispatchThread.run(EventDispatchThread.java:91)
Comment 1 Stephen Ranger 2013-05-21 21:40:33 CEST
Created attachment 468 [details]
JOGL-SWT Test Application
Comment 2 Stephen Ranger 2013-05-21 21:43:16 CEST
I had to remove the libaries from the zip (it was too large) so if you grab the SWT library (I used 4.2.2; the current version) and JOGL libraries (current release version) and update the build path in the eclpse project it shouldn't have too much trouble.

Also, just to be clear; I do work on a multi-display system with two monitors (30" Dell's @2560x1600). Not sure if it is part of the issue but just in case.
Comment 3 Julien Gouesse 2013-05-23 10:12:00 CEST
It seems to come from a problem between GTK and SWT, that's why you don't reproduce this bug under Windows. I thought a similar bug here:

There seems to be a problem with the way SWT handles multiple monitors.
Comment 4 Sven Gothel 2020-01-13 17:43:25 CET
No more reproducible and as Julien pointed out in comment 3,
probably and issue in the other modules (SWT etc).