Program: 46174
Project: 46174
Buggy source:
/** 
 * Processes attribute changes. Should be called within a synchronized block. 
 */
protected void processChanges(){
  boolean windowNeedsValidate=false;
  logger.fine("String_Node_Str" + this);
  logger.fine("String_Node_Str" + type);
  logger.fine("String_Node_Str" + Integer.toHexString(changeMask));
  if ((changeMask & (CHANGED_GEOMETRY | CHANGED_SIZE_APP | CHANGED_TYPE| CHANGED_PARENT| CHANGED_VISIBLE| CHANGED_ORTHO)) != 0) {
    logger.fine("String_Node_Str" + this);
switch (attachState) {
case ATTACHED_TO_ENTITY:
      if (parentEntity != null) {
        logger.fine("String_Node_Str" + entity + "String_Node_Str"+ parentEntity);
        RenderComponent rc=(RenderComponent)entity.getComponent(RenderComponent.class);
        sgChangeAttachPointSet(rc,null);
        parentEntity.removeEntity(entity);
        parentEntity=null;
      }
    break;
case ATTACHED_TO_WORLD:
  logger.fine("String_Node_Str" + entity + "String_Node_Str");
ClientContextJME.getWorldManager().removeEntity(entity);
break;
}
attachState=AttachState.DETACHED;
if ((changeMask & CHANGED_GEOMETRY) != 0) {
if (geometryNode != null) {
sgChangeGeometryDetachFromView(viewNode,geometryNode);
if (geometrySelfCreated) {
sgChangeGeometryCleanup(geometryNode);
geometrySelfCreated=false;
}
}
if (newGeometryNode != null) {
geometryNode=newGeometryNode;
newGeometryNode=null;
}
 else {
geometryNode=new GeometryNodeQuad(this);
geometrySelfCreated=true;
}
sgChangeGeometryAttachToView(viewNode,geometryNode);
}
if ((changeMask & (CHANGED_GEOMETRY | CHANGED_SIZE_APP)) != 0) {
logger.fine("String_Node_Str" + this);
if (geometryNode != null) {
DrawingSurfaceBufferedImage surface=(DrawingSurfaceBufferedImage)getWindow().getSurface();
if (surface != null) {
sgChangeGeometryTextureSet(geometryNode,getWindow().getTexture(),surface);
windowNeedsValidate=true;
}
}
}
if (isActuallyVisible()) {
if (ortho) {
logger.fine("String_Node_Str" + this);
logger.fine("String_Node_Str" + entity + "String_Node_Str");
ClientContextJME.getWorldManager().addEntity(entity);
attachState=AttachState.ATTACHED_TO_WORLD;
entity.getComponent(RenderComponent.class).setOrtho(true);
}
 else {
logger.fine("String_Node_Str" + this);
parentEntity=getParentEntity();
if (parentEntity == null) {
logger.warning("String_Node_Str");
}
 else {
logger.fine("String_Node_Str" + entity + "String_Node_Str"+ parentEntity);
parentEntity.addEntity(entity);
RenderComponent rc=(RenderComponent)entity.getComponent(RenderComponent.class);
RenderComponent rcParent=(RenderComponent)parentEntity.getComponent(RenderComponent.class);
sgChangeAttachPointSet(rc,rcParent.getSceneRoot());
attachState=AttachState.ATTACHED_TO_ENTITY;
entity.getComponent(RenderComponent.class).setOrtho(false);
}
}
}
if ((changeMask & CHANGED_ORTHO) != 0) {
logger.fine("String_Node_Str" + ortho + "String_Node_Str"+ this);
for (View2DEntity child : children) {
child.setOrtho(ortho);
}
}
if ((changeMask & CHANGED_VISIBLE) != 0) {
logger.fine("String_Node_Str" + this);
for (View2DEntity child : children) {
child.updateVisibility();
}
}
}
if ((changeMask & (CHANGED_DECORATED | CHANGED_TITLE | CHANGED_ORTHO| CHANGED_TYPE| CHANGED_PIXEL_SCALE)) != 0) {
logger.fine("String_Node_Str" + this);
logger.fine("String_Node_Str" + decorated);
if ((changeMask & (CHANGED_DECORATED | CHANGED_ORTHO)) != 0) {
if (decorated && !ortho) {
if (!hasFrame()) {
logger.fine("String_Node_Str");
attachFrame();
}
}
 else {
if (hasFrame()) {
logger.fine("String_Node_Str");
detachFrame();
}
}
}
if ((changeMask & (CHANGED_TYPE | CHANGED_ORTHO)) != 0) {
if (decorated && !ortho) {
reattachFrame();
}
}
}
if ((changeMask & (CHANGED_STACK | CHANGED_ORTHO)) != 0) {
logger.fine("String_Node_Str" + this);
if (ortho) {
int zOrder=window.getZOrder();
sgChangeGeometryOrthoZOrderSet(geometryNode,zOrder);
}
}
if ((changeMask & CHANGED_ORTHO) != 0) {
if (isActuallyVisible()) {
entity.getComponent(RenderComponent.class).setOrtho(ortho);
}
sgChangeViewNodeOrthoSet(viewNode,ortho);
}
if ((changeMask & (CHANGED_DECORATED | CHANGED_SIZE_APP | CHANGED_PIXEL_SCALE| CHANGED_ORTHO)) != 0) {
float width=getDisplayerLocalWidth();
float height=getDisplayerLocalHeight();
sgChangeGeometrySizeSet(geometryNode,width,height);
changeMask|=CHANGED_TEX_COORDS;
}
if ((changeMask & (CHANGED_TEX_COORDS | CHANGED_GEOMETRY | CHANGED_SIZE_APP)) != 0) {
float width=(float)sizeApp.width;
float height=(float)sizeApp.height;
Image image=getWindow().getTexture().getImage();
float widthRatio=width / image.getWidth();
float heightRatio=height / image.getHeight();
sgChangeGeometryTexCoordsSet(geometryNode,widthRatio,heightRatio);
windowNeedsValidate=true;
}
if ((changeMask & (CHANGED_TYPE | CHANGED_PARENT | CHANGED_PIXEL_SCALE| CHANGED_SIZE_APP| CHANGED_OFFSET| CHANGED_ORTHO| CHANGED_STACK)) != 0) {
CellTransform transform=null;
switch (type) {
case UNKNOWN:
case PRIMARY:
transform=new CellTransform(null,null,null);
break;
case SECONDARY:
case POPUP:
transform=calcOffsetStackTransform();
}
sgChangeGeometryTransformOffsetStackSet(geometryNode,transform);
}
if ((changeMask & (CHANGED_TYPE | CHANGED_USER_TRANSLATION | CHANGED_ORTHO| CHANGED_LOCATION_ORTHO| CHANGED_TYPE)) != 0) {
CellTransform deltaTransform;
switch (type) {
case UNKNOWN:
case PRIMARY:
deltaTransform=calcUserDeltaTransform();
updatePrimaryTransform(deltaTransform);
break;
case SECONDARY:
deltaTransform=calcUserDeltaTransform();
sgChangeTransformUserPostMultiply(viewNode,deltaTransform);
break;
case POPUP:
sgChangeTransformUserSet(viewNode,new CellTransform(null,null,null));
}
}
sgProcessChanges();
if (!ortho) {
frameUpdate();
}
if (windowNeedsValidate) {
if (window instanceof WindowSwing) {
((WindowSwing)window).validate();
}
}
if (window != null) {
DrawingSurface surface=window.getSurface();
if (surface != null) {
surface.setViewIsVisible(this,isActuallyVisible());
}
}
}

Fixed version (ground truth):
/** 
 * Processes attribute changes. Should be called within a synchronized block. 
 */
protected void processChanges(){
  boolean windowNeedsValidate=false;
  logger.fine("String_Node_Str" + this);
  logger.fine("String_Node_Str" + type);
  logger.fine("String_Node_Str" + Integer.toHexString(changeMask));
  if ((changeMask & (CHANGED_GEOMETRY | CHANGED_SIZE_APP | CHANGED_TYPE| CHANGED_PARENT| CHANGED_VISIBLE| CHANGED_ORTHO)) != 0) {
    logger.fine("String_Node_Str" + this);
switch (attachState) {
case ATTACHED_TO_ENTITY:
      if (parentEntity != null) {
        logger.fine("String_Node_Str" + entity + "String_Node_Str"+ parentEntity);
        RenderComponent rc=(RenderComponent)entity.getComponent(RenderComponent.class);
        sgChangeAttachPointSet(rc,null);
        parentEntity.removeEntity(entity);
        parentEntity=null;
      }
    break;
case ATTACHED_TO_WORLD:
  logger.fine("String_Node_Str" + entity + "String_Node_Str");
ClientContextJME.getWorldManager().removeEntity(entity);
break;
}
attachState=AttachState.DETACHED;
if ((changeMask & CHANGED_GEOMETRY) != 0) {
if (geometryNode != null) {
sgChangeGeometryDetachFromView(viewNode,geometryNode);
if (geometrySelfCreated) {
sgChangeGeometryCleanup(geometryNode);
geometrySelfCreated=false;
}
}
if (newGeometryNode != null) {
geometryNode=newGeometryNode;
newGeometryNode=null;
}
 else {
geometryNode=new GeometryNodeQuad(this);
geometrySelfCreated=true;
}
sgChangeGeometryAttachToView(viewNode,geometryNode);
}
if ((changeMask & (CHANGED_GEOMETRY | CHANGED_SIZE_APP)) != 0) {
logger.fine("String_Node_Str" + this);
if (geometryNode != null) {
DrawingSurfaceBufferedImage surface=(DrawingSurfaceBufferedImage)getWindow().getSurface();
if (surface != null) {
sgChangeGeometryTextureSet(geometryNode,getWindow().getTexture(),surface);
windowNeedsValidate=true;
}
}
}
if (isActuallyVisible()) {
if (ortho) {
logger.fine("String_Node_Str" + this);
entity.getComponent(RenderComponent.class).setOrtho(true);
if (type == Type.PRIMARY || type == Type.UNKNOWN) {
ClientContextJME.getWorldManager().addEntity(entity);
attachState=AttachState.ATTACHED_TO_WORLD;
logger.fine("String_Node_Str" + entity + "String_Node_Str");
}
 else {
parentEntity=getParentEntity();
if (parentEntity == null) {
  ClientContextJME.getWorldManager().addEntity(entity);
  attachState=AttachState.ATTACHED_TO_WORLD;
  logger.fine("String_Node_Str" + entity + "String_Node_Str");
}
 else {
  parentEntity.addEntity(entity);
  RenderComponent rc=(RenderComponent)entity.getComponent(RenderComponent.class);
  RenderComponent rcParent=(RenderComponent)parentEntity.getComponent(RenderComponent.class);
  sgChangeAttachPointSet(rc,rcParent.getSceneRoot());
  attachState=AttachState.ATTACHED_TO_ENTITY;
  logger.fine("String_Node_Str" + entity + "String_Node_Str"+ parentEntity);
}
}
}
 else {
logger.fine("String_Node_Str" + this);
parentEntity=getParentEntity();
if (parentEntity == null) {
logger.warning("String_Node_Str");
}
 else {
logger.fine("String_Node_Str" + entity + "String_Node_Str"+ parentEntity);
parentEntity.addEntity(entity);
RenderComponent rc=(RenderComponent)entity.getComponent(RenderComponent.class);
RenderComponent rcParent=(RenderComponent)parentEntity.getComponent(RenderComponent.class);
sgChangeAttachPointSet(rc,rcParent.getSceneRoot());
attachState=AttachState.ATTACHED_TO_ENTITY;
entity.getComponent(RenderComponent.class).setOrtho(false);
}
}
}
if ((changeMask & CHANGED_VISIBLE) != 0) {
logger.fine("String_Node_Str" + this);
for (View2DEntity child : children) {
child.updateVisibility();
}
}
}
if ((changeMask & (CHANGED_DECORATED | CHANGED_TITLE | CHANGED_ORTHO| CHANGED_TYPE| CHANGED_PIXEL_SCALE)) != 0) {
logger.fine("String_Node_Str" + this);
logger.fine("String_Node_Str" + decorated);
if ((changeMask & (CHANGED_DECORATED | CHANGED_ORTHO)) != 0) {
if (decorated && !ortho) {
if (!hasFrame()) {
logger.fine("String_Node_Str");
attachFrame();
}
}
 else {
if (hasFrame()) {
logger.fine("String_Node_Str");
detachFrame();
}
}
}
if ((changeMask & (CHANGED_TYPE | CHANGED_ORTHO)) != 0) {
if (decorated && !ortho) {
reattachFrame();
}
}
}
if ((changeMask & (CHANGED_STACK | CHANGED_ORTHO)) != 0) {
logger.fine("String_Node_Str" + this);
if (ortho) {
int zOrder=window.getZOrder();
logger.fine("String_Node_Str" + zOrder);
if (zOrder >= 0) {
sgChangeGeometryOrthoZOrderSet(geometryNode,zOrder);
}
}
}
if ((changeMask & CHANGED_ORTHO) != 0) {
if (isActuallyVisible()) {
entity.getComponent(RenderComponent.class).setOrtho(ortho);
}
sgChangeViewNodeOrthoSet(viewNode,ortho);
}
if ((changeMask & (CHANGED_DECORATED | CHANGED_SIZE_APP | CHANGED_PIXEL_SCALE| CHANGED_ORTHO)) != 0) {
float width=getDisplayerLocalWidth();
float height=getDisplayerLocalHeight();
sgChangeGeometrySizeSet(geometryNode,width,height);
changeMask|=CHANGED_TEX_COORDS;
}
if ((changeMask & (CHANGED_TEX_COORDS | CHANGED_GEOMETRY | CHANGED_SIZE_APP)) != 0) {
float width=(float)sizeApp.width;
float height=(float)sizeApp.height;
Image image=getWindow().getTexture().getImage();
float widthRatio=width / image.getWidth();
float heightRatio=height / image.getHeight();
sgChangeGeometryTexCoordsSet(geometryNode,widthRatio,heightRatio);
windowNeedsValidate=true;
}
if ((changeMask & (CHANGED_TYPE | CHANGED_PARENT | CHANGED_PIXEL_SCALE| CHANGED_SIZE_APP| CHANGED_OFFSET| CHANGED_ORTHO| CHANGED_STACK)) != 0) {
CellTransform transform=null;
switch (type) {
case UNKNOWN:
case PRIMARY:
transform=new CellTransform(null,null,null);
break;
case SECONDARY:
case POPUP:
transform=calcOffsetStackTransform();
}
sgChangeGeometryTransformOffsetStackSet(geometryNode,transform);
}
if ((changeMask & (CHANGED_TYPE | CHANGED_USER_TRANSLATION | CHANGED_ORTHO| CHANGED_LOCATION_ORTHO| CHANGED_TYPE)) != 0) {
CellTransform deltaTransform;
switch (type) {
case UNKNOWN:
case PRIMARY:
deltaTransform=calcUserDeltaTransform();
updatePrimaryTransform(deltaTransform);
break;
case SECONDARY:
deltaTransform=calcUserDeltaTransform();
sgChangeTransformUserPostMultiply(viewNode,deltaTransform);
break;
case POPUP:
sgChangeTransformUserSet(viewNode,new CellTransform(null,null,null));
}
}
sgProcessChanges();
if (!ortho) {
frameUpdate();
}
if (windowNeedsValidate) {
if (window instanceof WindowSwing) {
((WindowSwing)window).validate();
}
}
if (window != null) {
DrawingSurface surface=window.getSurface();
if (surface != null) {
surface.setViewIsVisible(this,isActuallyVisible());
}
}
logger.fine("String_Node_Str" + this);
for (View2DEntity child : children) {
if (child.changeMask != 0) {
child.update();
}
}
}