Program: 31116
Project: 31116
Buggy source:
@Override public void mouseReleased(Canvas canvas,Graphics g,MouseEvent e){
  Component added=null;
  if (state == SHOW_ADD) {
    Circuit circ=canvas.getCircuit();
    if (!canvas.getProject().getLogisimFile().contains(circ))     return;
    if (shouldSnap)     Canvas.snapToGrid(e);
    moveTo(canvas,g,e.getX(),e.getY());
    Location loc=Location.create(e.getX(),e.getY());
    AttributeSet attrsCopy=(AttributeSet)attrs.clone();
    attrsCopy.setValue(StdAttr.LABEL,AutoLabler.GetCurrent(canvas.getCircuit()));
    if (AutoLabler.IsActive(canvas.getCircuit())) {
      if (AutoLabler.hasNext(canvas.getCircuit()))       AutoLabler.GetNext(canvas.getCircuit());
 else       AutoLabler.Stop(canvas.getCircuit());
    }
 else     AutoLabler.SetLabel("String_Node_Str",canvas.getCircuit());
    ComponentFactory source=getFactory();
    if (source == null)     return;
    Component c=source.createComponent(loc,attrsCopy);
    if (circ.hasConflict(c)) {
      canvas.setErrorMessage(Strings.getter("String_Node_Str"));
      return;
    }
    Bounds bds=c.getBounds(g);
    if (bds.getX() < 0 || bds.getY() < 0) {
      canvas.setErrorMessage(Strings.getter("String_Node_Str"));
      return;
    }
    try {
      CircuitMutation mutation=new CircuitMutation(circ);
      mutation.add(c);
      Action action=mutation.toAction(Strings.getter("String_Node_Str",factory.getDisplayGetter()));
      canvas.getProject().doAction(action);
      lastAddition=action;
      added=c;
      canvas.repaint();
    }
 catch (    CircuitException ex) {
      JOptionPane.showMessageDialog(canvas.getProject().getFrame(),ex.getMessage());
    }
    setState(canvas,SHOW_GHOST);
  }
 else   if (state == SHOW_ADD_NO) {
    setState(canvas,SHOW_NONE);
  }
  Project proj=canvas.getProject();
  Tool next=determineNext(proj);
  if (next != null) {
    proj.setTool(next);
    Action act=SelectionActions.dropAll(canvas.getSelection());
    if (act != null) {
      proj.doAction(act);
    }
    if (added != null)     canvas.getSelection().add(added);
  }
}

Fixed version (ground truth):
@Override public void mouseReleased(Canvas canvas,Graphics g,MouseEvent e){
  Component added=null;
  if (state == SHOW_ADD) {
    Circuit circ=canvas.getCircuit();
    if (!canvas.getProject().getLogisimFile().contains(circ))     return;
    if (shouldSnap)     Canvas.snapToGrid(e);
    moveTo(canvas,g,e.getX(),e.getY());
    Location loc=Location.create(e.getX(),e.getY());
    ComponentFactory source=getFactory();
    AttributeSet attrsCopy=(AttributeSet)attrs.clone();
    attrsCopy.setValue(StdAttr.LABEL,AutoLabler.GetCurrent(canvas.getCircuit(),source));
    if (AutoLabler.IsActive(canvas.getCircuit())) {
      if (AutoLabler.hasNext(canvas.getCircuit()))       AutoLabler.GetNext(canvas.getCircuit(),source);
 else       AutoLabler.Stop(canvas.getCircuit());
    }
 else     AutoLabler.SetLabel("String_Node_Str",canvas.getCircuit(),source);
    if (source == null)     return;
    Component c=source.createComponent(loc,attrsCopy);
    if (circ.hasConflict(c)) {
      canvas.setErrorMessage(Strings.getter("String_Node_Str"));
      return;
    }
    Bounds bds=c.getBounds(g);
    if (bds.getX() < 0 || bds.getY() < 0) {
      canvas.setErrorMessage(Strings.getter("String_Node_Str"));
      return;
    }
    try {
      CircuitMutation mutation=new CircuitMutation(circ);
      mutation.add(c);
      Action action=mutation.toAction(Strings.getter("String_Node_Str",factory.getDisplayGetter()));
      canvas.getProject().doAction(action);
      lastAddition=action;
      added=c;
      canvas.repaint();
    }
 catch (    CircuitException ex) {
      JOptionPane.showMessageDialog(canvas.getProject().getFrame(),ex.getMessage());
    }
    setState(canvas,SHOW_GHOST);
  }
 else   if (state == SHOW_ADD_NO) {
    setState(canvas,SHOW_NONE);
  }
  Project proj=canvas.getProject();
  Tool next=determineNext(proj);
  if (next != null) {
    proj.setTool(next);
    Action act=SelectionActions.dropAll(canvas.getSelection());
    if (act != null) {
      proj.doAction(act);
    }
    if (added != null)     canvas.getSelection().add(added);
  }
}