Program: 70724
Project: 70724
Buggy source:
public void processSelection(GLAutoDrawable drawable){
  GL2GL3 gl=(GL2GL3)(drawable.getGL());
  myViewer.setColorEnabled(true);
  myViewer.setDepthEnabled(true);
  myViewer.setLightingEnabled(true);
  myViewer.setMultiSampleEnabled(savedMultisampled);
  if (changeViewport) {
    gl.glViewport(mySavedViewport[0],mySavedViewport[1],mySavedViewport[2],mySavedViewport[3]);
  }
  myViewer.clearPickMatrix();
  if (!myMaxQStack.isEmpty()) {
    throw new IllegalStateException("String_Node_Str");
  }
  flushQueries(myGl);
  if (myGLQueryTotal == 0) {
    myViewer.setSelected(null);
  }
 else {
    int qid=0;
    LinkedList<HitRecord> records=new LinkedList<HitRecord>();
    Iterator<IsRenderable> it=myViewer.renderIterator();
    while (it.hasNext()) {
      IsRenderable r=it.next();
      if (r instanceof IsSelectable) {
        IsSelectable s=(IsSelectable)r;
        int numq=s.numSelectionQueriesNeeded();
        int nums=(numq >= 0 ? numq : 1);
        if (s.isSelectable()) {
          for (int i=0; i < nums; i++) {
            if (myQuerySamples[qid + i] > 0) {
              HitRecord rec=new HitRecord(myQuerySamples[qid + i]);
              if (numq < 0) {
                rec.objs.add(s);
              }
 else {
                s.getSelection(rec.objs,i);
              }
              if (rec.objs.size() > 0) {
                records.add(rec);
              }
            }
          }
        }
        qid+=nums;
      }
    }
    Collections.sort(records);
    ArrayList<LinkedList<?>> selObjs=new ArrayList<>(records.size());
    for (int i=0; i < records.size(); i++) {
      selObjs.add(records.get(i).objs);
    }
    myViewer.setSelected(selObjs);
  }
  gl.glDeleteQueries(myTotalMaxQ,myGLQueries,0);
  myGLQueries=null;
  myGLQueryIds=null;
  myGl=null;
  ViewerSelectionListener[] listeners=myViewer.getSelectionListeners();
  for (int i=0; i < listeners.length; i++) {
    listeners[i].itemsSelected(myViewer.getSelectionEvent());
  }
  myViewer.getCanvas().repaint();
}

Fixed version (ground truth):
public void processSelection(GLAutoDrawable drawable){
  GL2GL3 gl=(GL2GL3)(drawable.getGL());
  myViewer.setColorEnabled(true);
  myViewer.setDepthEnabled(true);
  myViewer.setLightingEnabled(true);
  myViewer.setMultiSampleEnabled(savedMultisampled);
  if (changeViewport) {
    gl.glViewport(mySavedViewport[0],mySavedViewport[1],mySavedViewport[2],mySavedViewport[3]);
  }
  myViewer.clearPickMatrix();
  if (!myMaxQStack.isEmpty()) {
    throw new IllegalStateException("String_Node_Str");
  }
  flushQueries(myGl);
  if (myGLQueryTotal == 0) {
    myViewer.setSelected(null);
  }
 else {
    int qid=0;
    LinkedList<HitRecord> records=new LinkedList<HitRecord>();
    Iterator<IsRenderable> it=myViewer.renderIterator();
    while (it.hasNext()) {
      IsRenderable r=it.next();
      if (r instanceof IsSelectable) {
        IsSelectable s=(IsSelectable)r;
        int numq=s.numSelectionQueriesNeeded();
        int nums=(numq >= 0 ? numq : 1);
        if (s.isSelectable()) {
          for (int i=0; i < nums; i++) {
            if (myQuerySamples[qid + i] > 0) {
              HitRecord rec=new HitRecord(myQuerySamples[qid + i]);
              if (numq < 0) {
                rec.objs.add(s);
              }
 else {
                s.getSelection(rec.objs,i);
              }
              if (rec.objs.size() > 0) {
                records.add(rec);
              }
            }
          }
        }
        qid+=nums;
      }
    }
    Collections.sort(records);
    ArrayList<LinkedList<?>> selObjs=new ArrayList<>(records.size());
    for (int i=0; i < records.size(); i++) {
      selObjs.add(records.get(i).objs);
    }
    myViewer.setSelected(selObjs);
  }
  gl.glDeleteQueries(myGLQueries.length,myGLQueries,0);
  myGLQueries=null;
  myGLQueryIds=null;
  myGl=null;
  ViewerSelectionListener[] listeners=myViewer.getSelectionListeners();
  for (int i=0; i < listeners.length; i++) {
    listeners[i].itemsSelected(myViewer.getSelectionEvent());
  }
  myViewer.getCanvas().repaint();
}