Program: 11167
Project: 11167
Buggy source:
private synchronized void playAnnotations(){
  if (!playing) {
    playing=true;
    final View view=wwd.getView();
    view.addPropertyChangeListener(AVKey.VIEW,new PropertyChangeListener(){
      public void propertyChange(      PropertyChangeEvent evt){
        if (!view.isAnimating()) {
          stopAnnotations();
        }
        if (!playing) {
          view.removePropertyChangeListener(AVKey.VIEW,this);
        }
      }
    }
);
    Thread thread=new Thread(new Runnable(){
      public void run(){
        ListItem item=(ListItem)list.getSelectedValue();
        List<Annotation> annotations=Settings.get().getAnnotations();
        int index=-1;
        if (item != null) {
          index=annotations.indexOf(item.annotation);
        }
 else         if (!annotations.isEmpty()) {
          index=0;
        }
        long jump=100;
        while (playing && index >= 0) {
          Annotation annotation=annotations.get(index);
          if (!annotation.isExcludeFromPlaylist()) {
            selectAnnotation(annotation);
            long length=flyToAnnotation(annotation);
            if (length < 0)             break;
            length+=Settings.get().getAnnotationsPause();
            for (; playing && length > jump; length-=jump) {
              sleep(jump);
            }
            if (playing)             sleep(length);
          }
          int nextIndex=index;
          while (true) {
            if (++nextIndex >= annotations.size())             nextIndex=0;
            if (nextIndex == index) {
              index=-1;
              break;
            }
            if (!annotations.get(nextIndex).isExcludeFromPlaylist()) {
              index=nextIndex;
              break;
            }
          }
        }
        stopAnnotations();
      }
      private void sleep(      long millis){
        try {
          Thread.sleep(millis);
        }
 catch (        InterruptedException e) {
          e.printStackTrace();
        }
      }
    }
);
    thread.setName("String_Node_Str");
    thread.setDaemon(true);
    thread.start();
  }
  playButton.setIcon(Icons.stop);
  playButton.setToolTipText("String_Node_Str");
  enableButtons();
}

Fixed version (ground truth):
private synchronized void playAnnotations(){
  if (!playing) {
    playing=true;
    wwd.getInputHandler().addMouseListener(new MouseAdapter(){
      @Override public void mousePressed(      MouseEvent e){
        stopAnnotations();
        if (!playing) {
          wwd.getInputHandler().removeMouseListener(this);
        }
      }
    }
);
    Thread thread=new Thread(new Runnable(){
      public void run(){
        ListItem item=(ListItem)list.getSelectedValue();
        List<Annotation> annotations=Settings.get().getAnnotations();
        int index=-1;
        if (item != null) {
          index=annotations.indexOf(item.annotation);
        }
 else         if (!annotations.isEmpty()) {
          index=0;
        }
        long jump=100;
        while (playing && index >= 0) {
          Annotation annotation=annotations.get(index);
          if (!annotation.isExcludeFromPlaylist()) {
            selectAnnotation(annotation);
            long length=flyToAnnotation(annotation);
            if (length < 0)             break;
            length+=Settings.get().getAnnotationsPause();
            for (; playing && length > jump; length-=jump) {
              sleep(jump);
            }
            if (playing)             sleep(length);
          }
          int nextIndex=index;
          while (true) {
            if (++nextIndex >= annotations.size())             nextIndex=0;
            if (nextIndex == index) {
              index=-1;
              break;
            }
            if (!annotations.get(nextIndex).isExcludeFromPlaylist()) {
              index=nextIndex;
              break;
            }
          }
        }
        stopAnnotations();
      }
      private void sleep(      long millis){
        try {
          Thread.sleep(millis);
        }
 catch (        InterruptedException e) {
          e.printStackTrace();
        }
      }
    }
);
    thread.setName("String_Node_Str");
    thread.setDaemon(true);
    thread.start();
  }
  playButton.setIcon(Icons.stop);
  playButton.setToolTipText("String_Node_Str");
  enableButtons();
}