Program: 95809
Project: 95809
Buggy source:
/** 
 * Enables or disables the confirmer. If the confirmer is enabled, the JavaFX Filter is added to the currently focused stage so that the confirmer starts storing events of the configured class of events. If it is disabled, the listener is removed from the AWT event queue.
 * @param enabled <code>true</code> or <code>false</code>.
 */
public void setEnabled(boolean enabled){
  m_enabled=enabled;
  m_eventList.clear();
  if (m_enabled) {
    final long[] masks=m_options.getEventMask();
    for (int i=0; i < masks.length; i++) {
      for (      final ReadOnlyObjectProperty<? extends Window> w : m_sceneGraphs) {
        if (w.getValue() == null) {
          m_sceneGraphs.remove(w);
          continue;
        }
        final Window win=w.get();
        final long mask=masks[i];
        final RobotEventConfirmerJavaFXImpl me=this;
        EventThreadQueuerJavaFXImpl.invokeAndWait("String_Node_Str",new Callable<Void>(){
          @Override public Void call() throws Exception {
            win.addEventFilter(JavaFXEventConverter.awtToFX(mask),new WeakEventHandler<>(me));
            return null;
          }
        }
);
      }
    }
  }
 else {
    long[] masks=m_options.getEventMask();
    for (int i=0; i < masks.length; i++) {
      for (      ReadOnlyObjectProperty<? extends Window> w : m_sceneGraphs) {
        if (w.getValue() == null) {
          m_sceneGraphs.remove(w);
          continue;
        }
        final Window win=w.get();
        final long mask=masks[i];
        final RobotEventConfirmerJavaFXImpl me=this;
        EventThreadQueuerJavaFXImpl.invokeAndWait("String_Node_Str",new Callable<Void>(){
          @Override public Void call() throws Exception {
            win.removeEventFilter(JavaFXEventConverter.awtToFX(mask),new WeakEventHandler<>(me));
            return null;
          }
        }
);
      }
    }
  }
}

Fixed version (ground truth):
/** 
 * Enables or disables the confirmer. If the confirmer is enabled, the JavaFX Filter is added to the currently focused stage so that the confirmer starts storing events of the configured class of events. If it is disabled, the listener is removed from the AWT event queue.
 * @param enabled <code>true</code> or <code>false</code>.
 */
public void setEnabled(boolean enabled){
  m_enabled=enabled;
  m_eventList.clear();
  if (m_enabled) {
    final long[] masks=m_options.getEventMask();
    for (int i=0; i < masks.length; i++) {
      for (      final ReadOnlyObjectProperty<? extends Window> w : m_sceneGraphs) {
        if (w.getValue() == null || !(w.getValue().isShowing())) {
          m_sceneGraphs.remove(w);
          continue;
        }
        final Window win=w.get();
        final long mask=masks[i];
        final RobotEventConfirmerJavaFXImpl me=this;
        EventThreadQueuerJavaFXImpl.invokeAndWait("String_Node_Str",new Callable<Void>(){
          @Override public Void call() throws Exception {
            win.addEventFilter(JavaFXEventConverter.awtToFX(mask),new WeakEventHandler<>(me));
            return null;
          }
        }
);
      }
    }
  }
 else {
    long[] masks=m_options.getEventMask();
    for (int i=0; i < masks.length; i++) {
      for (      ReadOnlyObjectProperty<? extends Window> w : m_sceneGraphs) {
        if (w.getValue() == null || !(w.getValue().isShowing())) {
          m_sceneGraphs.remove(w);
          continue;
        }
        final Window win=w.get();
        final long mask=masks[i];
        final RobotEventConfirmerJavaFXImpl me=this;
        EventThreadQueuerJavaFXImpl.invokeAndWait("String_Node_Str",new Callable<Void>(){
          @Override public Void call() throws Exception {
            win.removeEventFilter(JavaFXEventConverter.awtToFX(mask),new WeakEventHandler<>(me));
            return null;
          }
        }
);
      }
    }
  }
}