Program: 46241
Project: 46241
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);
  if ((changeMask & (CHANGED_TOPOLOGY | CHANGED_ORTHO)) != 0) {
    logger.fine("String_Node_Str");
    int chgMask=changeMask & ~CATEGORY_CHANGE_MASK;
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 ((chgMask & 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 ((chgMask & (CHANGED_TEXTURE | CHANGED_GEOMETRY)) != 0) {
logger.fine("String_Node_Str");
if (geometryNode != null) {
sgChangeGeometryTextureSet(geometryNode,getWindow().getTexture());
windowNeedsValidate=true;
}
}
if (isActuallyVisible()) {
if (ortho) {
logger.fine("String_Node_Str");
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");
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 ((chgMask & CHANGED_ORTHO) != 0) {
logger.fine("String_Node_Str" + ortho);
for (View2DEntity child : children) {
child.setOrtho(ortho);
}
}
if ((chgMask & CHANGED_VISIBLE) != 0) {
logger.fine("String_Node_Str");
for (View2DEntity child : children) {
child.updateVisibility();
}
}
}
if ((changeMask & (CHANGED_FRAME | CHANGED_ORTHO | CHANGED_TYPE)) != 0) {
logger.fine("String_Node_Str");
int chgMask=changeMask & ~CATEGORY_CHANGE_MASK;
if ((chgMask & (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 ((chgMask & CHANGED_TYPE) != 0) {
if (decorated && !ortho) {
reattachFrame();
}
}
}
if ((changeMask & CHANGED_Z_ORDER) != 0) {
logger.fine("String_Node_Str");
sgChangeGeometryOrthoZOrderSet(geometryNode,zOrder);
}
if ((changeMask & CHANGED_ORTHO) != 0) {
if (isActuallyVisible()) {
entity.getComponent(RenderComponent.class).setOrtho(ortho);
}
sgChangeViewNodeOrthoSet(viewNode,ortho);
}
if ((changeMask & (CHANGED_SIZE | CHANGED_ORTHO | CHANGED_PIXEL_SCALE)) != 0) {
float width=getDisplayerLocalWidth();
float height=getDisplayerLocalHeight();
sgChangeGeometrySizeSet(geometryNode,width,height);
}
if ((changeMask & (CHANGED_TEX_COORDS | CHANGED_GEOMETRY)) != 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_OFFSET_STACK_TRANSFORM | CHANGED_ORTHO | CHANGED_Z_ORDER| CHANGED_PIXEL_SCALE)) != 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_USER_TRANSFORM | 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();
frameUpdate();
if (windowNeedsValidate) {
if (window instanceof WindowSwing) {
((WindowSwing)window).validate();
}
}
}

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);
  if ((changeMask & (CHANGED_TOPOLOGY | CHANGED_ORTHO)) != 0) {
    logger.fine("String_Node_Str");
    int chgMask=changeMask & ~CATEGORY_CHANGE_MASK;
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 ((chgMask & 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 ((chgMask & (CHANGED_TEXTURE | CHANGED_GEOMETRY)) != 0) {
logger.fine("String_Node_Str");
if (geometryNode != null) {
sgChangeGeometryTextureSet(geometryNode,getWindow().getTexture());
windowNeedsValidate=true;
}
}
if (isActuallyVisible()) {
if (ortho) {
logger.fine("String_Node_Str");
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");
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 ((chgMask & CHANGED_ORTHO) != 0) {
logger.fine("String_Node_Str" + ortho);
for (View2DEntity child : children) {
child.setOrtho(ortho);
}
}
if ((chgMask & CHANGED_VISIBLE) != 0) {
logger.fine("String_Node_Str");
for (View2DEntity child : children) {
child.updateVisibility();
}
}
}
if ((changeMask & (CHANGED_FRAME | CHANGED_ORTHO | CHANGED_TYPE)) != 0) {
logger.fine("String_Node_Str");
int chgMask=changeMask & ~CATEGORY_CHANGE_MASK;
if ((chgMask & (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 ((chgMask & CHANGED_TYPE) != 0) {
if (decorated && !ortho) {
reattachFrame();
}
}
}
if ((changeMask & CHANGED_Z_ORDER) != 0) {
logger.fine("String_Node_Str");
sgChangeGeometryOrthoZOrderSet(geometryNode,zOrder);
}
if ((changeMask & CHANGED_ORTHO) != 0) {
if (isActuallyVisible()) {
entity.getComponent(RenderComponent.class).setOrtho(ortho);
}
sgChangeViewNodeOrthoSet(viewNode,ortho);
}
if ((changeMask & (CHANGED_SIZE | CHANGED_ORTHO | CHANGED_PIXEL_SCALE)) != 0) {
float width=getDisplayerLocalWidth();
float height=getDisplayerLocalHeight();
sgChangeGeometrySizeSet(geometryNode,width,height);
changeMask|=CHANGED_TEX_COORDS;
}
if ((changeMask & (CHANGED_TEX_COORDS | CHANGED_GEOMETRY)) != 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_OFFSET_STACK_TRANSFORM | CHANGED_ORTHO | CHANGED_Z_ORDER| CHANGED_PIXEL_SCALE)) != 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_USER_TRANSFORM | 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();
frameUpdate();
if (windowNeedsValidate) {
if (window instanceof WindowSwing) {
((WindowSwing)window).validate();
}
}
}