Login  Register

Re: NewtCanvasSWT Linux Exception with GTK_VERSION

Posted by Wade Walker on Feb 18, 2019; 4:23pm
URL: https://forum.jogamp.org/NewtCanvasSWT-Linux-Exception-with-GTK-VERSION-tp4039442p4039550.html

I extended the timeouts on the TestNewtCanvasSWTGLn unit test, and now I can duplicate this failure even when stepping through the test in the debugger. I put breakpoints on gdk_window_begin_draw_frame() and gdk_window_end_draw_frame() in the GDK library so I could check if any calls to these are unpaired.

But they aren't! I see six properly paired calls to begin/end, then on the seventh begin, it throws the
(SWT:15054): Gdk-CRITICAL **: 07:54:54.539: The window 0x7f073d2ec640 already has a drawing context. You cannot call gdk_window_begin_draw_frame() without calling gdk_window_end_draw_frame() first.
 The error always happens after the same number of calls, and is perfectly reproducible.

What's more, these calls to gdk_window_begin_draw_frame()/gdk_window_end_draw_frame() are always in a call stack of pure GTK/SWT code. There's no JOGL code at all being invoked during window event processing. JOGL calls Display.readAndDispatch() at the top level, but that's it. This makes me think the problem has to do with how the NewtCanvasSWT is set up in the first place, but that part of the JOGL code is pretty difficult to understand.

So in short, I think there are two bugs here. Bug #1 was that SWTAccessor didn't work with newer versions of SWT, which is fixed by the patch I posted. But bug #2 is that JOGL's NewtCanvasSWT doesn't work with GTK 3.22.30 on Ubuntu 18.04 for reasons which are still unknown.