Program: 30376
Project: 30376
Buggy source:
@Override public void clicked(InputEvent event,float x,float y){
  Scene scn=scnWidget.getScene();
  if (scn == null)   return;
  Vector2 p=new Vector2(Gdx.input.getX(),Gdx.input.getY());
  scnWidget.screenToWorldCoords(p);
  if (deleteObstacle) {
    deleteObstacle=false;
    Ctx.msg.hide();
    PolygonalNavGraph pf=scn.getPolygonalNavGraph();
    ArrayList<Polygon> obstacles=scn.getPolygonalNavGraph().getObstacles();
    for (int j=0; j < obstacles.size(); j++) {
      Polygon o=obstacles.get(j);
      if (o.contains(p.x,p.y)) {
        Ctx.project.getSelectedChapter().deleteObstacle(Ctx.project.getSelectedScene(),j);
        pf.getObstacles().remove(j);
        return;
      }
    }
  }
  if (getTapCount() == 2) {
    Polygon poly=scnWidget.getSelectedActor().getBBox();
    if (scn.getPolygonalNavGraph() != null && scnWidget.getShowWalkZone()) {
      poly=scn.getPolygonalNavGraph().getWalkZone();
      ArrayList<Polygon> obstacles=scn.getPolygonalNavGraph().getObstacles();
      if (Gdx.input.isKeyPressed(Keys.CONTROL_LEFT)) {
        boolean deleted=PolygonUtils.deletePoint(poly,p.x,p.y,CanvasDrawer.CORNER_DIST);
        if (deleted) {
          Ctx.project.getSelectedChapter().setWalkZonePolygon(Ctx.project.getSelectedScene(),poly);
          return;
        }
 else {
          for (int i=0; i < obstacles.size(); i++) {
            Polygon o=obstacles.get(i);
            deleted=PolygonUtils.deletePoint(o,p.x,p.y,CanvasDrawer.CORNER_DIST);
            if (deleted) {
              Ctx.project.getSelectedChapter().setObstaclePolygon(Ctx.project.getSelectedScene(),i,o);
              return;
            }
          }
        }
      }
 else {
        boolean created=PolygonUtils.addClampPointIfTolerance(poly,p.x,p.y,CanvasDrawer.CORNER_DIST);
        if (created) {
          Ctx.project.getSelectedChapter().setWalkZonePolygon(Ctx.project.getSelectedScene(),poly);
          return;
        }
 else {
          for (int i=0; i < obstacles.size(); i++) {
            Polygon o=obstacles.get(i);
            created=PolygonUtils.addClampPointIfTolerance(o,p.x,p.y,CanvasDrawer.CORNER_DIST);
            if (created) {
              Ctx.project.getSelectedChapter().setObstaclePolygon(Ctx.project.getSelectedScene(),i,o);
              return;
            }
          }
        }
      }
    }
    if (!(scnWidget.getSelectedActor() instanceof SpriteActor) || !((SpriteActor)scnWidget.getSelectedActor()).isBboxFromRenderer()) {
      if (Gdx.input.isKeyPressed(Keys.CONTROL_LEFT)) {
        boolean deleted=PolygonUtils.deletePoint(poly,p.x,p.y,CanvasDrawer.CORNER_DIST);
        if (deleted) {
          Ctx.project.getSelectedChapter().setBbox(Ctx.project.getSelectedActor(),poly);
          return;
        }
      }
 else {
        boolean created=PolygonUtils.addClampPointIfTolerance(poly,p.x,p.y,CanvasDrawer.CORNER_DIST);
        if (created) {
          Ctx.project.getSelectedChapter().setBbox(Ctx.project.getSelectedActor(),poly);
          return;
        }
      }
    }
  }
}

Fixed version (ground truth):
@Override public void clicked(InputEvent event,float x,float y){
  Scene scn=scnWidget.getScene();
  if (scn == null)   return;
  Vector2 p=new Vector2(Gdx.input.getX(),Gdx.input.getY());
  scnWidget.screenToWorldCoords(p);
  if (deleteObstacle) {
    deleteObstacle=false;
    Ctx.msg.hide();
    PolygonalNavGraph pf=scn.getPolygonalNavGraph();
    ArrayList<Polygon> obstacles=scn.getPolygonalNavGraph().getObstacles();
    for (int j=0; j < obstacles.size(); j++) {
      Polygon o=obstacles.get(j);
      if (o.contains(p.x,p.y)) {
        Ctx.project.getSelectedChapter().deleteObstacle(Ctx.project.getSelectedScene(),j);
        pf.getObstacles().remove(j);
        return;
      }
    }
  }
  if (getTapCount() == 2) {
    if (scn.getPolygonalNavGraph() != null && scnWidget.getShowWalkZone()) {
      Polygon poly=scn.getPolygonalNavGraph().getWalkZone();
      ArrayList<Polygon> obstacles=scn.getPolygonalNavGraph().getObstacles();
      if (Gdx.input.isKeyPressed(Keys.CONTROL_LEFT)) {
        boolean deleted=PolygonUtils.deletePoint(poly,p.x,p.y,CanvasDrawer.CORNER_DIST);
        if (deleted) {
          Ctx.project.getSelectedChapter().setWalkZonePolygon(Ctx.project.getSelectedScene(),poly);
          return;
        }
 else {
          for (int i=0; i < obstacles.size(); i++) {
            Polygon o=obstacles.get(i);
            deleted=PolygonUtils.deletePoint(o,p.x,p.y,CanvasDrawer.CORNER_DIST);
            if (deleted) {
              Ctx.project.getSelectedChapter().setObstaclePolygon(Ctx.project.getSelectedScene(),i,o);
              return;
            }
          }
        }
      }
 else {
        boolean created=PolygonUtils.addClampPointIfTolerance(poly,p.x,p.y,CanvasDrawer.CORNER_DIST);
        if (created) {
          Ctx.project.getSelectedChapter().setWalkZonePolygon(Ctx.project.getSelectedScene(),poly);
          return;
        }
 else {
          for (int i=0; i < obstacles.size(); i++) {
            Polygon o=obstacles.get(i);
            created=PolygonUtils.addClampPointIfTolerance(o,p.x,p.y,CanvasDrawer.CORNER_DIST);
            if (created) {
              Ctx.project.getSelectedChapter().setObstaclePolygon(Ctx.project.getSelectedScene(),i,o);
              return;
            }
          }
        }
      }
    }
    if (scnWidget.getSelectedActor() != null) {
      Polygon poly=scnWidget.getSelectedActor().getBBox();
      if (!(scnWidget.getSelectedActor() instanceof SpriteActor) || !((SpriteActor)scnWidget.getSelectedActor()).isBboxFromRenderer()) {
        if (Gdx.input.isKeyPressed(Keys.CONTROL_LEFT)) {
          boolean deleted=PolygonUtils.deletePoint(poly,p.x,p.y,CanvasDrawer.CORNER_DIST);
          if (deleted) {
            Ctx.project.getSelectedChapter().setBbox(Ctx.project.getSelectedActor(),poly);
            return;
          }
        }
 else {
          boolean created=PolygonUtils.addClampPointIfTolerance(poly,p.x,p.y,CanvasDrawer.CORNER_DIST);
          if (created) {
            Ctx.project.getSelectedChapter().setBbox(Ctx.project.getSelectedActor(),poly);
            return;
          }
        }
      }
    }
  }
}