Bug 1161

Summary: Canvas resize stops the rendering in Mac OS X
Product: [JogAmp] Jogl Reporter: president
Component: awtAssignee: Sven Gothel <sgothel>
Status: RESOLVED FIXED    
Severity: major    
Priority: ---    
Version: 2.3.2   
Hardware: pc_all   
OS: macosx   
Type: DEFECT SCM Refs:
4eeddd0d446f8491dde2e5b0e3e11e0d5b0be9b7
Workaround: ---

Description president 2015-06-11 15:29:26 CEST
There is a "resize" problem with JOGL in Mac OS X.

When I run the following jogl demo it works fine at first. But when I try to resize it the canvas disappears. I just see a blank jpanel in its place.

http://jogamp.org/deployment/jogamp-current/jogl-demos/Gears.jnlp

The Mac OS X version is 10.9.5 or higher 
Java 1.8.0_45

It also doesn't work on Yosemite 10.10.3
It is reproducible both with and without Java Webstart. Our standalone application has same problem.

This bug was first reported in jogl forum here:
http://forum.jogamp.org/Resize-problem-td4034612.html
Comment 1 Sven Gothel 2015-07-25 19:17:06 CEST
Test machine 
  - OSX 10.10.4
  - Java 1.8.0_51 x64
  - Java 1.6.0_65-b14-466.1 x32 and x64

JOGL Unit Tests:
  - com.jogamp.opengl.test.junit.jogl.demos.es2.awt.TestGearsES2AWT: OK
  - com.jogamp.opengl.test.junit.jogl.demos.gl2.awt.TestGearsAWT: OK

JOGL Demos:
  - Manual demos.gears.Gears: OK

  - JNLP Launch reproduces the issue: ERROR
      <http://jogamp.org/deployment/archive/master/gluegen_868-joal_596-jogl_1401-jocl_1057-signed/jogl-demos/Gears.jnlp>

    - Error is reproduced if resizing very fast about a bigger amount,
      e.g. 50% - for the first time!

    - Error is not reproduced if first resize happen slowly about
      a tiny amount. Later fast resizes work then.

Hence we do have an issue at least on latest OSX w/ latest java8
when running as WebStart - and w/ 'fast resize'.
Comment 2 Sven Gothel 2015-07-28 00:36:54 CEST
Root cause:

JAWTWindow's JAWTComponentListener 'isShowing'
state is initialized while attaching it on-thread
and updated via hierarchy-changed event.

JAWTComponentListener attachment to the component 
is issued at JAWTWindow's creation but on the AWT-EDT,
hence it may happen at a later time.

In this bug scenario, it happens very late,
so that the hierarchy-changed event is missed 
and 'isShowing' is never set to 'true'.

Solution is to update 'isShowing' state
on the actual AWT-EDT when attaching to the component.
Also make 'isShowing' volatile.
Comment 3 Sven Gothel 2015-07-28 00:38:34 CEST
commit 4eeddd0d446f8491dde2e5b0e3e11e0d5b0be9b7

Fixed as described in comment 2