Program: 58979
Project: 58979
Buggy source:
/** 
 * Function used for updating cursor position in case of dragging
 * @param gl
 */
private void handleCursorDragging(final GL gl){
  Point currentPoint=pickingTriggerMouseAdapter.getPickedPoint();
  float[] fArTargetWorldCoordinates=new float[3];
  float fselElement;
  fArTargetWorldCoordinates=GLCoordinateUtils.convertWindowCoordinatesToWorldCoordinates(gl,currentPoint.x,currentPoint.y);
  float fHeight=viewFrustum.getHeight() - 0.2f;
  float fStep=fHeight / iAlNumberSamples.get(0);
  if (iDraggedCursor == 1) {
    fPosCursorFirstElement=fArTargetWorldCoordinates[1] - 0.1f;
    if (fPosCursorFirstElement > fPosCursorLastElement && iFirstSample >= 0) {
      fselElement=(viewFrustum.getHeight() - 0.1f - fArTargetWorldCoordinates[1]) / fStep;
      if ((int)Math.floor(fselElement) >= 0) {
        iFirstSample=(int)Math.floor(fselElement);
        iSamplesPerHeatmap=iLastSample - iFirstSample + 1;
      }
    }
  }
  if (iDraggedCursor == 2) {
    fPosCursorLastElement=fArTargetWorldCoordinates[1] - 0.1f;
    if (fPosCursorFirstElement > fPosCursorLastElement && iLastSample <= iAlNumberSamples.get(0))     ;
{
      fselElement=(viewFrustum.getHeight() - 0.1f - fArTargetWorldCoordinates[1]) / fStep;
      if ((int)Math.ceil(fselElement) < iAlNumberSamples.get(0))       ;
{
        iLastSample=(int)Math.ceil(fselElement);
        iSamplesPerHeatmap=iLastSample - iFirstSample + 1;
      }
    }
  }
  setDisplayListDirty();
  triggerSelectionBlock();
  if (pickingTriggerMouseAdapter.wasMouseReleased()) {
    bIsDraggingActive=false;
  }
}

Fixed version (ground truth):
/** 
 * Function used for updating cursor position in case of dragging
 * @param gl
 */
private void handleCursorDragging(final GL gl){
  Point currentPoint=pickingTriggerMouseAdapter.getPickedPoint();
  float[] fArTargetWorldCoordinates=new float[3];
  float fselElement;
  fArTargetWorldCoordinates=GLCoordinateUtils.convertWindowCoordinatesToWorldCoordinates(gl,currentPoint.x,currentPoint.y);
  float fHeight=viewFrustum.getHeight() - 0.2f;
  float fStep=fHeight / iAlNumberSamples.get(0);
  float fPosCursor;
  if (iDraggedCursor == 1) {
    fPosCursor=fArTargetWorldCoordinates[1] - 0.1f;
    if (fPosCursor > fPosCursorLastElement && iFirstSample >= 0) {
      fPosCursorFirstElement=fPosCursor;
      fselElement=(viewFrustum.getHeight() - 0.1f - fArTargetWorldCoordinates[1]) / fStep;
      if ((int)Math.floor(fselElement) >= 0) {
        iFirstSample=(int)Math.floor(fselElement);
        iSamplesPerHeatmap=iLastSample - iFirstSample + 1;
      }
    }
  }
  if (iDraggedCursor == 2) {
    fPosCursor=fArTargetWorldCoordinates[1] - 0.1f;
    if (fPosCursorFirstElement > fPosCursor && iLastSample <= iAlNumberSamples.get(0))     ;
{
      fPosCursorLastElement=fPosCursor;
      fselElement=(viewFrustum.getHeight() - 0.1f - fArTargetWorldCoordinates[1]) / fStep;
      if ((int)Math.ceil(fselElement) < iAlNumberSamples.get(0))       ;
{
        iLastSample=(int)Math.ceil(fselElement);
        iSamplesPerHeatmap=iLastSample - iFirstSample + 1;
      }
    }
  }
  generalManager.getPreferenceStore().setValue(PreferenceConstants.HM_NUM_SAMPLES_PER_HEATMAP,iSamplesPerHeatmap);
  setDisplayListDirty();
  triggerSelectionBlock();
  if (pickingTriggerMouseAdapter.wasMouseReleased()) {
    bIsDraggingActive=false;
  }
}