Program: 143394
Project: 143394
Buggy source:
public void updateRelatedVisibleForms(List<Pair<String,String>> oldForms,List<Pair<String,String>> newForms){
  if (oldForms != null) {
    for (    Pair<String,String> oldForm : oldForms) {
      if (!newForms.contains(oldForm)) {
        IWebFormController formController=getApplication().getFormManager().getForm(oldForm.getLeft());
        List<Runnable> invokeLaterRunnables=new ArrayList<Runnable>();
        formController.notifyVisible(false,invokeLaterRunnables);
        Utils.invokeLater(getApplication(),invokeLaterRunnables);
      }
    }
  }
  if (newForms != null) {
    for (    Pair<String,String> newVisibleForm : newForms) {
      if (!oldForms.contains(newVisibleForm)) {
        IWebFormController newFormController=getApplication().getFormManager().getForm(newVisibleForm.getLeft());
        addRelatedForm(newFormController,newVisibleForm.getRight(),true);
        if (newVisibleForm.getRight() != null) {
          newFormController.loadRecords(record != null ? record.getRelatedFoundSet(newVisibleForm.getRight(),((BasicFormController)newFormController).getDefaultSortColumns()) : null);
        }
        updateParentContainer(newFormController,newVisibleForm.getRight(),formController.isFormVisible());
        List<Runnable> invokeLaterRunnables=new ArrayList<Runnable>();
        newFormController.notifyVisible(formController.isFormVisible(),invokeLaterRunnables);
        Utils.invokeLater(getApplication(),invokeLaterRunnables);
      }
 else {
        oldForms.remove(newVisibleForm);
      }
    }
  }
  if (oldForms != null) {
    for (    Pair<String,String> oldForm : oldForms) {
      if (Utils.equalObjects(uninitializedRelatedForms.get(oldForm.getLeft()),oldForm.getRight())) {
        uninitializedRelatedForms.remove(oldForm.getLeft());
      }
      for (      IWebFormController relatedController : relatedForms.keySet()) {
        if (Utils.equalObjects(relatedController.getName(),oldForm.getLeft()) && Utils.equalObjects(oldForm.getRight(),relatedForms.get(relatedController))) {
          relatedForms.remove(relatedController);
          break;
        }
      }
    }
  }
}

Fixed version (ground truth):
public void updateRelatedVisibleForms(List<Pair<String,String>> oldForms,List<Pair<String,String>> newForms){
  if (oldForms != null) {
    for (    Pair<String,String> oldForm : oldForms) {
      if (!newForms.contains(oldForm)) {
        IWebFormController fc=getApplication().getFormManager().getForm(oldForm.getLeft());
        List<Runnable> invokeLaterRunnables=new ArrayList<Runnable>();
        fc.notifyVisible(false,invokeLaterRunnables);
        Utils.invokeLater(getApplication(),invokeLaterRunnables);
        removeVisibleChildForm(fc,true);
      }
    }
  }
  if (newForms != null) {
    for (    Pair<String,String> newVisibleForm : newForms) {
      if (!oldForms.contains(newVisibleForm)) {
        IWebFormController newFormController=getApplication().getFormManager().getForm(newVisibleForm.getLeft());
        addVisibleChildForm(newFormController,newVisibleForm.getRight(),true);
        if (newVisibleForm.getRight() != null) {
          newFormController.loadRecords(record != null ? record.getRelatedFoundSet(newVisibleForm.getRight(),((BasicFormController)newFormController).getDefaultSortColumns()) : null);
        }
        updateParentContainer(newFormController,newVisibleForm.getRight(),formController.isFormVisible());
        List<Runnable> invokeLaterRunnables=new ArrayList<Runnable>();
        newFormController.notifyVisible(formController.isFormVisible(),invokeLaterRunnables);
        Utils.invokeLater(getApplication(),invokeLaterRunnables);
      }
 else {
        oldForms.remove(newVisibleForm);
      }
    }
  }
}