nus-yam/ex-repair huggingface dataset:
Program: 96341
Project: 96341
Buggy source:
/** 
 * This removes a menu entry or sub-menu (via the text label) from the dropdown menu.
 * @param menuText This is the label for the menu entry or sub-menu to remove
 */
public void remove(final String menuText){
  final AtomicBoolean hasValue=new AtomicBoolean(true);
  dispatchAndWait(new Runnable(){
    @Override public void run(){
synchronized (menuEntries) {
        MenuEntry menuEntry=get(menuText);
        if (menuEntry == null) {
          hasValue.set(false);
        }
 else {
          remove(menuEntry);
        }
      }
    }
  }
);
  if (!hasValue.get()) {
    throw new NullPointerException("String_Node_Str" + menuText + "String_Node_Str");
  }
}

Fixed version (ground truth):
/** 
 * This removes a menu entry or sub-menu (via the text label) from the dropdown menu.
 * @param menuText This is the label for the menu entry or sub-menu to remove
 */
public void remove(final String menuText){
  dispatchAndWait(new Runnable(){
    @Override public void run(){
synchronized (menuEntries) {
        MenuEntry menuEntry=get(menuText);
        if (menuEntry != null) {
          remove(menuEntry);
        }
      }
    }
  }
);
}
Program: 96342
Project: 96342
Buggy source:
/** 
 * Deletes the menu, and unreferences everything in it. ALSO recreates ONLY the menu object.
 */
void deleteMenu(){
  if (_native != null) {
synchronized (menuEntries) {
      for (int i=0; i < menuEntries.size(); i++) {
        MenuEntry menuEntry__=menuEntries.get(i);
        if (menuEntry__ instanceof GtkEntry) {
          GtkEntry entry=(GtkEntry)menuEntry__;
          Gobject.g_object_force_floating(entry._native);
          Gtk.gtk_container_remove(_native,entry._native);
        }
 else         if (menuEntry__ instanceof GtkMenu) {
          GtkMenu subMenu=(GtkMenu)menuEntry__;
          Gobject.g_object_force_floating(subMenu.menuEntry._native);
          Gtk.gtk_container_remove(_native,subMenu.menuEntry._native);
        }
      }
      Gtk.gtk_widget_destroy(_native);
    }
  }
  if (getParent() != null) {
    ((GtkMenu)getParent()).deleteMenu();
  }
  _native=Gtk.gtk_menu_new();
  if (menuEntry != null) {
    Gtk.gtk_menu_item_set_submenu(menuEntry._native,_native);
  }
}

Fixed version (ground truth):
/** 
 * Deletes the menu, and unreferences everything in it. ALSO recreates ONLY the menu object.
 */
void deleteMenu(){
  if (_native != null && !obliterateInProgress) {
synchronized (menuEntries) {
      for (int i=0; i < menuEntries.size(); i++) {
        MenuEntry menuEntry__=menuEntries.get(i);
        if (menuEntry__ instanceof GtkEntry) {
          GtkEntry entry=(GtkEntry)menuEntry__;
          Gobject.g_object_force_floating(entry._native);
          Gtk.gtk_container_remove(_native,entry._native);
        }
 else         if (menuEntry__ instanceof GtkMenu) {
          GtkMenu subMenu=(GtkMenu)menuEntry__;
          Gobject.g_object_force_floating(subMenu.menuEntry._native);
          Gtk.gtk_container_remove(_native,subMenu.menuEntry._native);
        }
      }
      Gtk.gtk_widget_destroy(_native);
    }
  }
  if (getParent() != null) {
    ((GtkMenu)getParent()).deleteMenu();
  }
  _native=Gtk.gtk_menu_new();
  if (menuEntry != null) {
    Gtk.gtk_menu_item_set_submenu(menuEntry._native,_native);
  }
}
Program: 96343
Project: 96343
Buggy source:
/** 
 * Completely obliterates the menu, no possible way to reconstruct it.
 */
void obliterateMenu(){
  if (_native != null) {
synchronized (menuEntries) {
      for (int i=0; i < menuEntries.size(); i++) {
        MenuEntry menuEntry__=menuEntries.get(i);
        if (menuEntry__ instanceof GtkEntry) {
          ((GtkEntry)menuEntry__).removePrivate();
        }
 else         if (menuEntry__ instanceof GtkMenu) {
          ((GtkMenu)menuEntry__).removePrivate();
        }
      }
      menuEntries.clear();
      Gtk.gtk_widget_destroy(_native);
    }
  }
}

Fixed version (ground truth):
/** 
 * Completely obliterates the menu, no possible way to reconstruct it.
 */
void obliterateMenu(){
  if (_native != null && !obliterateInProgress) {
    obliterateInProgress=true;
synchronized (menuEntries) {
      for (int i=0; i < menuEntries.size(); i++) {
        MenuEntry menuEntry__=menuEntries.get(i);
        if (menuEntry__ instanceof GtkEntry) {
          ((GtkEntry)menuEntry__).removePrivate();
        }
 else         if (menuEntry__ instanceof GtkMenu) {
          ((GtkMenu)menuEntry__).removePrivate();
        }
      }
      menuEntries.clear();
      Gtk.gtk_widget_destroy(_native);
    }
    obliterateInProgress=false;
  }
}
Program: 96344
Project: 96344
Buggy source:
void createMenu(){
  if (getParent() != null) {
    ((GtkMenu)getParent()).createMenu();
  }
  boolean hasImages=false;
synchronized (menuEntries) {
    for (int i=0; i < menuEntries.size(); i++) {
      MenuEntry menuEntry__=menuEntries.get(i);
      hasImages|=menuEntry__.hasImage();
    }
    for (int i=0; i < menuEntries.size(); i++) {
      MenuEntry menuEntry__=menuEntries.get(i);
      if (menuEntry__ instanceof GtkEntry) {
        GtkEntry entry=(GtkEntry)menuEntry__;
        entry.setSpacerImage(hasImages);
        Gtk.gtk_menu_shell_append(this._native,entry._native);
        Gobject.g_object_ref_sink(entry._native);
      }
 else       if (menuEntry__ instanceof GtkMenu) {
        GtkMenu subMenu=(GtkMenu)menuEntry__;
        Gtk.gtk_menu_shell_append(this._native,subMenu.menuEntry._native);
        Gobject.g_object_ref_sink(subMenu.menuEntry._native);
        if (subMenu.getParent() != GtkMenu.this) {
          subMenu.createMenu();
        }
      }
    }
    onMenuAdded(_native);
    Gtk.gtk_widget_show_all(_native);
  }
}

Fixed version (ground truth):
void createMenu(){
  if (obliterateInProgress) {
    return;
  }
  if (getParent() != null) {
    ((GtkMenu)getParent()).createMenu();
  }
  boolean hasImages=false;
synchronized (menuEntries) {
    for (int i=0; i < menuEntries.size(); i++) {
      MenuEntry menuEntry__=menuEntries.get(i);
      hasImages|=menuEntry__.hasImage();
    }
    for (int i=0; i < menuEntries.size(); i++) {
      MenuEntry menuEntry__=menuEntries.get(i);
      if (menuEntry__ instanceof GtkEntry) {
        GtkEntry entry=(GtkEntry)menuEntry__;
        entry.setSpacerImage(hasImages);
        Gtk.gtk_menu_shell_append(this._native,entry._native);
        Gobject.g_object_ref_sink(entry._native);
      }
 else       if (menuEntry__ instanceof GtkMenu) {
        GtkMenu subMenu=(GtkMenu)menuEntry__;
        Gtk.gtk_menu_shell_append(this._native,subMenu.menuEntry._native);
        Gobject.g_object_ref_sink(subMenu.menuEntry._native);
        if (subMenu.getParent() != GtkMenu.this) {
          subMenu.createMenu();
        }
      }
    }
    onMenuAdded(_native);
    Gtk.gtk_widget_show_all(_native);
  }
}
Program: 96345
Project: 96345
Buggy source:
/** 
 * Necessary to guarantee all updates occur on the dispatch thread
 */
protected void dispatchAndWait(final Runnable runnable){
  final CountDownLatch countDownLatch=new CountDownLatch(1);
  Gtk.dispatch(new Runnable(){
    @Override public void run(){
      try {
        runnable.run();
      }
  finally {
        countDownLatch.countDown();
      }
    }
  }
);
  try {
    if (!countDownLatch.await(TIMEOUT,TimeUnit.SECONDS)) {
      throw new RuntimeException("String_Node_Str" + TIMEOUT + "String_Node_Str"+ "String_Node_Str");
    }
  }
 catch (  InterruptedException e) {
    SystemTray.logger.error("String_Node_Str",new Exception());
  }
}

Fixed version (ground truth):
/** 
 * Necessary to guarantee all updates occur on the dispatch thread
 */
protected void dispatchAndWait(final Runnable runnable){
  final CountDownLatch countDownLatch=new CountDownLatch(1);
  Gtk.dispatch(new Runnable(){
    @Override public void run(){
      try {
        runnable.run();
      }
  finally {
        countDownLatch.countDown();
      }
    }
  }
);
  try {
    if (!countDownLatch.await(TIMEOUT,TimeUnit.SECONDS)) {
      if (SystemTray.DEBUG) {
        SystemTray.logger.error("String_Node_Str" + TIMEOUT + "String_Node_Str"+ "String_Node_Str");
      }
 else {
        throw new RuntimeException("String_Node_Str" + TIMEOUT + "String_Node_Str"+ "String_Node_Str");
      }
    }
  }
 catch (  InterruptedException e) {
    SystemTray.logger.error("String_Node_Str",new Exception());
  }
}
Program: 96346
Project: 96346
Buggy source:
public void shutdown(){
  dispatch(new Runnable(){
    @Override public void run(){
      obliterateMenu();
      Gtk.shutdownGui();
    }
  }
);
}

Fixed version (ground truth):
public void shutdown(){
  dispatchAndWait(new Runnable(){
    @Override public void run(){
      obliterateMenu();
      Gtk.shutdownGui();
    }
  }
);
}
Program: 96347
Project: 96347
Buggy source:
@Override public void setVisible(boolean makeVisible){
  this.hiddenDialog.setVisible(makeVisible);
  this.hiddenDialog.setEnabled(false);
  this.hiddenDialog.setUndecorated(true);
  super.setVisible(makeVisible);
}

Fixed version (ground truth):
@Override public void setVisible(boolean makeVisible){
  this.hiddenDialog.setVisible(makeVisible);
  this.hiddenDialog.setEnabled(false);
  super.setVisible(makeVisible);
}
Program: 96348
Project: 96348
Buggy source:
/** 
 * @param systemTray the system tray (which is the object that sits in the system tray)
 * @param parent the parent of this menu, null if the parent is the system tray
 */
public SwingMenu(final SystemTray systemTray,final Menu parent){
  super(systemTray,parent);
  SwingUtil.invokeAndWait(new Runnable(){
    @Override public void run(){
      if (parent != null) {
        _native=new AdjustedJMenu();
        ((SwingMenu)parent)._native.add(_native);
      }
 else {
        _native=new SwingSystemTrayMenuPopup();
      }
    }
  }
);
}

Fixed version (ground truth):
/** 
 * @param systemTray the system tray (which is the object that sits in the system tray)
 * @param parent the parent of this menu, null if the parent is the system tray
 */
public SwingMenu(final SystemTray systemTray,final Menu parent){
  super(systemTray,parent);
  SwingUtil.invokeAndWait(new Runnable(){
    @Override public void run(){
      if (parent != null) {
        _native=new AdjustedJMenu((SwingSystemTrayMenuPopup)((SwingMenu)systemTray.getMenu())._native);
        ((SwingMenu)parent)._native.add(_native);
      }
 else {
        _native=new SwingSystemTrayMenuPopup();
      }
    }
  }
);
}
Program: 96349
Project: 96349
Buggy source:
/** 
 * Creates a new system tray handler class.
 */
public SwingSystemTray(final dorkbox.systemTray.SystemTray systemTray){
  super(systemTray,null);
  _native=new SwingSystemTrayMenuPopup();
  ImageUtils.determineIconSize(dorkbox.systemTray.SystemTray.TYPE_SWING);
  SwingUtil.invokeAndWait(new Runnable(){
    @Override public void run(){
      SwingSystemTray.this.tray=SystemTray.getSystemTray();
    }
  }
);
}

Fixed version (ground truth):
/** 
 * Creates a new system tray handler class.
 */
public SwingSystemTray(final dorkbox.systemTray.SystemTray systemTray){
  super(systemTray,null);
  ImageUtils.determineIconSize(dorkbox.systemTray.SystemTray.TYPE_SWING);
  SwingUtil.invokeAndWait(new Runnable(){
    @Override public void run(){
      SwingSystemTray.this.tray=SystemTray.getSystemTray();
    }
  }
);
}
Program: 96350
Project: 96350
Buggy source:
public SwingSystemTrayMenuPopup(){
  super();
  setFocusable(true);
  setBorder(new EmptyBorder(1,1,1,1));
  this.timer=new DelayTimer("String_Node_Str",true,new Runnable(){
    @Override public void run(){
      SwingUtil.invokeLater(new Runnable(){
        @Override public void run(){
          Point location=MouseInfo.getPointerInfo().getLocation();
          Point menuLocation=getLocationOnScreen();
          Dimension size=getSize();
          if (location.x >= menuLocation.x && location.x < menuLocation.x + size.width && location.y >= menuLocation.y && location.y < menuLocation.y + size.height) {
            SwingSystemTrayMenuPopup.this.timer.delay(POPUP_HIDE_DELAY);
          }
 else           if (mouseClickLocation != null && location.x >= mouseClickLocation.x - MOVEMENT_DELTA && location.x < mouseClickLocation.x + MOVEMENT_DELTA && location.y >= mouseClickLocation.y - MOVEMENT_DELTA && location.y < mouseClickLocation.y + MOVEMENT_DELTA) {
            SwingSystemTrayMenuPopup.this.timer.delay(POPUP_HIDE_DELAY);
          }
 else {
            setVisible(false);
          }
        }
      }
);
    }
  }
);
  addMouseListener(new MouseAdapter(){
    @Override public void mouseExited(    MouseEvent event){
      SwingSystemTrayMenuPopup.this.timer.delay(SwingSystemTrayMenuPopup.this.timer.getDelay());
    }
  }
);
}

Fixed version (ground truth):
public SwingSystemTrayMenuPopup(){
  super();
  setFocusable(true);
  setBorder(new EmptyBorder(1,1,1,1));
  trackedMenus.add(this);
  this.timer=new DelayTimer("String_Node_Str",true,new Runnable(){
    @Override public void run(){
      SwingUtil.invokeLater(new Runnable(){
        @Override public void run(){
          Point location=MouseInfo.getPointerInfo().getLocation();
synchronized (trackedMenus) {
            for (            JPopupMenu trackedMenu : trackedMenus) {
              Point menuLocation=trackedMenu.getLocationOnScreen();
              Dimension size=trackedMenu.getSize();
              if (location.x >= menuLocation.x && location.x < menuLocation.x + size.width && location.y >= menuLocation.y && location.y < menuLocation.y + size.height) {
                SwingSystemTrayMenuPopup.this.timer.delay(POPUP_HIDE_DELAY);
                return;
              }
            }
          }
          if (mouseClickLocation != null && location.x >= mouseClickLocation.x - MOVEMENT_DELTA && location.x < mouseClickLocation.x + MOVEMENT_DELTA && location.y >= mouseClickLocation.y - MOVEMENT_DELTA && location.y < mouseClickLocation.y + MOVEMENT_DELTA) {
            SwingSystemTrayMenuPopup.this.timer.delay(POPUP_HIDE_DELAY);
            return;
          }
          setVisible(false);
        }
      }
);
    }
  }
);
  addMouseListener(new MouseAdapter(){
    @Override public void mouseExited(    MouseEvent event){
      SwingSystemTrayMenuPopup.this.timer.delay(SwingSystemTrayMenuPopup.this.timer.getDelay());
    }
  }
);
}
Program: 96351
Project: 96351
Buggy source:
@Override public void run(){
  Point location=MouseInfo.getPointerInfo().getLocation();
  Point menuLocation=getLocationOnScreen();
  Dimension size=getSize();
  if (location.x >= menuLocation.x && location.x < menuLocation.x + size.width && location.y >= menuLocation.y && location.y < menuLocation.y + size.height) {
    SwingSystemTrayMenuPopup.this.timer.delay(POPUP_HIDE_DELAY);
  }
 else   if (mouseClickLocation != null && location.x >= mouseClickLocation.x - MOVEMENT_DELTA && location.x < mouseClickLocation.x + MOVEMENT_DELTA && location.y >= mouseClickLocation.y - MOVEMENT_DELTA && location.y < mouseClickLocation.y + MOVEMENT_DELTA) {
    SwingSystemTrayMenuPopup.this.timer.delay(POPUP_HIDE_DELAY);
  }
 else {
    setVisible(false);
  }
}

Fixed version (ground truth):
@Override public void run(){
  Point location=MouseInfo.getPointerInfo().getLocation();
synchronized (trackedMenus) {
    for (    JPopupMenu trackedMenu : trackedMenus) {
      Point menuLocation=trackedMenu.getLocationOnScreen();
      Dimension size=trackedMenu.getSize();
      if (location.x >= menuLocation.x && location.x < menuLocation.x + size.width && location.y >= menuLocation.y && location.y < menuLocation.y + size.height) {
        SwingSystemTrayMenuPopup.this.timer.delay(POPUP_HIDE_DELAY);
        return;
      }
    }
  }
  if (mouseClickLocation != null && location.x >= mouseClickLocation.x - MOVEMENT_DELTA && location.x < mouseClickLocation.x + MOVEMENT_DELTA && location.y >= mouseClickLocation.y - MOVEMENT_DELTA && location.y < mouseClickLocation.y + MOVEMENT_DELTA) {
    SwingSystemTrayMenuPopup.this.timer.delay(POPUP_HIDE_DELAY);
    return;
  }
  setVisible(false);
}
Program: 96353
Project: 96353
Buggy source:
/** 
 * Changes the tray icon used. Because the cross-platform, underlying system uses a file path to load icons for the system tray, this will copy the contents of the imageStream to a temporary location on disk.
 * @param imageStream the InputStream of the icon to use
 */
public void setIcon(InputStream imageStream){
  setIcon_(ImageUtils.resizeAndCache(ImageUtils.SIZE,imageStream));
}

Fixed version (ground truth):
/** 
 * Changes the tray icon used. Because the cross-platform, underlying system uses a file path to load icons for the system tray, this will copy the contents of the imageStream to a temporary location on disk.
 * @param imageStream the InputStream of the icon to use
 */
public void setIcon(InputStream imageStream){
  setIcon_(ImageUtils.resizeAndCache(ImageUtils.TRAY_SIZE,imageStream));
}
Program: 96355
Project: 96355
Buggy source:
@Override @Deprecated public void setImage(final InputStream imageStream){
  if (imageStream == null) {
    setImage_(null);
  }
 else {
    setImage_(ImageUtils.resizeAndCache(ImageUtils.SIZE,imageStream));
  }
}

Fixed version (ground truth):
@Override @Deprecated public void setImage(final InputStream imageStream){
  if (imageStream == null) {
    setImage_(null);
  }
 else {
    setImage_(ImageUtils.resizeAndCache(ImageUtils.ENTRY_SIZE,imageStream));
  }
}
Program: 96356
Project: 96356
Buggy source:
@Override @Deprecated public void addMenuEntry(final String menuText,final InputStream imageStream,final SystemTrayMenuAction callback){
  if (imageStream == null) {
    addMenuEntry_(menuText,null,callback);
  }
 else {
    addMenuEntry_(menuText,ImageUtils.resizeAndCache(ImageUtils.SIZE,imageStream),callback);
  }
}

Fixed version (ground truth):
@Override @Deprecated public void addMenuEntry(final String menuText,final InputStream imageStream,final SystemTrayMenuAction callback){
  if (imageStream == null) {
    addMenuEntry_(menuText,null,callback);
  }
 else {
    addMenuEntry_(menuText,ImageUtils.resizeAndCache(ImageUtils.ENTRY_SIZE,imageStream),callback);
  }
}
Program: 96357
Project: 96357
Buggy source:
@Override @Deprecated public void setImage(final InputStream imageStream){
  if (imageStream == null) {
    setImage_(null);
  }
 else {
    setImage_(ImageUtils.resizeAndCache(ImageUtils.SIZE,imageStream));
  }
}

Fixed version (ground truth):
@Override @Deprecated public void setImage(final InputStream imageStream){
  if (imageStream == null) {
    setImage_(null);
  }
 else {
    setImage_(ImageUtils.resizeAndCache(ImageUtils.ENTRY_SIZE,imageStream));
  }
}
Program: 96358
Project: 96358
Buggy source:
@Override @Deprecated public void addMenuEntry(final String menuText,final InputStream imageStream,final SystemTrayMenuAction callback){
  if (imageStream == null) {
    addMenuEntry_(menuText,null,callback);
  }
 else {
    addMenuEntry_(menuText,ImageUtils.resizeAndCache(ImageUtils.SIZE,imageStream),callback);
  }
}

Fixed version (ground truth):
@Override @Deprecated public void addMenuEntry(final String menuText,final InputStream imageStream,final SystemTrayMenuAction callback){
  if (imageStream == null) {
    addMenuEntry_(menuText,null,callback);
  }
 else {
    addMenuEntry_(menuText,ImageUtils.resizeAndCache(ImageUtils.ENTRY_SIZE,imageStream),callback);
  }
}
Program: 96360
Project: 96360
Buggy source:
public GtkSystemTray(){
  super();
  Gtk.startGui();
  dispatch(new Runnable(){
    @Override public void run(){
      final Pointer trayIcon_=Gtk.gtk_status_icon_new();
      trayIcon=trayIcon_;
      final GEventCallback gtkCallback=new GEventCallback(){
        @Override public void callback(        Pointer notUsed,        final GdkEventButton event){
          if (event.type == 4) {
            Gtk.gtk_menu_popup(getMenu(),null,null,Gtk.gtk_status_icon_position_menu,trayIcon,0,event.time);
          }
        }
      }
;
      final NativeLong button_press_event=Gobject.g_signal_connect_object(trayIcon,"String_Node_Str",gtkCallback,null,0);
      gtkCallbacks.add(gtkCallback);
      gtkCallbacks.add(button_press_event);
    }
  }
);
  super.waitForStartup();
  ImageUtils.determineIconSize(SystemTray.TYPE_GTKSTATUSICON);
  dispatch(new Runnable(){
    @Override public void run(){
      Gtk.gtk_status_icon_set_title(trayIcon,"String_Node_Str");
    }
  }
);
}

Fixed version (ground truth):
public GtkSystemTray(){
  super();
  Gtk.startGui();
  dispatch(new Runnable(){
    @Override public void run(){
      final Pointer trayIcon_=Gtk.gtk_status_icon_new();
      trayIcon=trayIcon_;
      final GEventCallback gtkCallback=new GEventCallback(){
        @Override public void callback(        Pointer notUsed,        final GdkEventButton event){
          if (event.type == 4) {
            Gtk.gtk_menu_popup(getMenu(),null,null,Gtk.gtk_status_icon_position_menu,trayIcon,0,event.time);
          }
        }
      }
;
      final NativeLong button_press_event=Gobject.g_signal_connect_object(trayIcon,"String_Node_Str",gtkCallback,null,0);
      gtkCallbacks.add(gtkCallback);
      gtkCallbacks.add(button_press_event);
    }
  }
);
  super.waitForStartup();
  ImageUtils.determineIconSize(SystemTray.TYPE_GTKSTATUSICON);
  dispatch(new Runnable(){
    @Override public void run(){
      Gtk.gtk_status_icon_set_title(trayIcon,"String_Node_Str");
      if (SystemTray.isJavaFxLoaded) {
        Gtk.gtk_status_icon_set_name(trayIcon,"String_Node_Str");
      }
    }
  }
);
}
Program: 96361
Project: 96361
Buggy source:
@Override protected void setIcon_(final String iconPath){
  dispatch(new Runnable(){
    @Override public void run(){
      Gtk.gtk_status_icon_set_from_file(trayIcon,iconPath);
      if (!isActive) {
        isActive=true;
        Gtk.gtk_status_icon_set_name(trayIcon,"String_Node_Str");
        Gtk.gtk_status_icon_set_visible(trayIcon,true);
      }
    }
  }
);
}

Fixed version (ground truth):
@Override protected void setIcon_(final String iconPath){
  dispatch(new Runnable(){
    @Override public void run(){
      Gtk.gtk_status_icon_set_from_file(trayIcon,iconPath);
      if (!isActive) {
        isActive=true;
        Gtk.gtk_status_icon_set_visible(trayIcon,true);
      }
    }
  }
);
}
Program: 96362
Project: 96362
Buggy source:
@Override public void run(){
  Gtk.gtk_status_icon_set_from_file(trayIcon,iconPath);
  if (!isActive) {
    isActive=true;
    Gtk.gtk_status_icon_set_name(trayIcon,"String_Node_Str");
    Gtk.gtk_status_icon_set_visible(trayIcon,true);
  }
}

Fixed version (ground truth):
@Override public void run(){
  Gtk.gtk_status_icon_set_from_file(trayIcon,iconPath);
  if (!isActive) {
    isActive=true;
    Gtk.gtk_status_icon_set_visible(trayIcon,true);
  }
}
Program: 96366
Project: 96366
Buggy source:
/** 
 * Resizes the image (as a FILE on disk, or as a RESOURCE name), saves it as a file on disk. This file will be OVER-WRITTEN by any operation that calls this method.
 * @return the file string on disk that is the resized icon
 */
@SuppressWarnings("String_Node_Str") private static String resizeFile(final int size,final String fileName) throws IOException {
  FileInputStream fileInputStream=new FileInputStream(fileName);
  Dimension imageSize=getImageSize(fileInputStream);
  if (size == ((int)imageSize.getWidth()) && size == ((int)imageSize.getHeight())) {
    return fileName;
  }
  File newFile=new File(TEMP_DIR,"String_Node_Str").getAbsoluteFile();
  Image image;
  File iconTest=new File(fileName);
  if (iconTest.isFile() && iconTest.canRead()) {
    final String absolutePath=iconTest.getAbsolutePath();
    image=new ImageIcon(absolutePath).getImage().getScaledInstance(size,-1,Image.SCALE_SMOOTH);
    image.flush();
  }
 else {
    final URL systemResource=LocationResolver.getResource(fileName);
    image=new ImageIcon(systemResource).getImage().getScaledInstance(size,-1,Image.SCALE_SMOOTH);
    image.flush();
  }
  image=new ImageIcon(image).getImage();
  image.flush();
  newFile.getParentFile().mkdirs();
  newFile.delete();
  String extension=FileUtil.getExtension(fileName);
  if (extension.equals("String_Node_Str")) {
    extension="String_Node_Str";
  }
  BufferedImage bufferedImage=getBufferedImage(image);
  ImageIO.write(bufferedImage,extension,newFile);
  return newFile.getAbsolutePath();
}

Fixed version (ground truth):
/** 
 * Resizes the image (as a FILE on disk, or as a RESOURCE name), saves it as a file on disk. This file will be OVER-WRITTEN by any operation that calls this method.
 * @return the file string on disk that is the resized icon
 */
@SuppressWarnings("String_Node_Str") private static String resizeFile(final int size,final String fileName) throws IOException {
  FileInputStream fileInputStream=new FileInputStream(fileName);
  Dimension imageSize=getImageSize(fileInputStream);
  if (size == ((int)imageSize.getWidth()) && size == ((int)imageSize.getHeight())) {
    return fileName;
  }
  File newFile=new File(TEMP_DIR,"String_Node_Str" + FileUtil.getExtension(fileName)).getAbsoluteFile();
  Image image;
  File iconTest=new File(fileName);
  if (iconTest.isFile() && iconTest.canRead()) {
    final String absolutePath=iconTest.getAbsolutePath();
    image=new ImageIcon(absolutePath).getImage().getScaledInstance(size,-1,Image.SCALE_SMOOTH);
    image.flush();
  }
 else {
    final URL systemResource=LocationResolver.getResource(fileName);
    image=new ImageIcon(systemResource).getImage().getScaledInstance(size,-1,Image.SCALE_SMOOTH);
    image.flush();
  }
  image=new ImageIcon(image).getImage();
  image.flush();
  newFile.getParentFile().mkdirs();
  newFile.delete();
  String extension=FileUtil.getExtension(fileName);
  if (extension.equals("String_Node_Str")) {
    extension="String_Node_Str";
  }
  BufferedImage bufferedImage=getBufferedImage(image);
  ImageIO.write(bufferedImage,extension,newFile);
  return newFile.getAbsolutePath();
}
Program: 96367
Project: 96367
Buggy source:
/** 
 * Specifies the new image to set for a menu entry, NULL to delete the image This method **DOES NOT CACHE** the result, so multiple lookups for the same inputStream result in new files every time. This is also NOT RECOMMENDED, but is provided for simplicity.
 * @param imageStream the InputStream of the image to use
 */
@Deprecated void setImage(InputStream imageStream);

Fixed version (ground truth):
/** 
 * Specifies the new image to set for a menu entry, NULL to delete the image This method **DOES NOT CACHE** the result, so multiple lookups for the same inputStream result in new files every time. This is also NOT RECOMMENDED, but is provided for simplicity.
 * @param imageStream the InputStream of the image to use
 */
void setImage(InputStream imageStream);
Program: 96368
Project: 96368
Buggy source:
private void setImage_(final File imagePath){
  Gtk.dispatch(new Runnable(){
    @Override public void run(){
      if (image != null) {
        Gtk.gtk_widget_destroy(image);
        image=null;
      }
      Gtk.gtk_widget_show_all(menuItem);
      if (imagePath != null) {
        image=Gtk.gtk_image_new_from_file(imagePath.getAbsolutePath());
        Gtk.gtk_image_menu_item_set_image(menuItem,image);
        Gobject.g_object_ref_sink(image);
        Gtk.gtk_image_menu_item_set_always_show_image(menuItem,Gtk.TRUE);
      }
      Gtk.gtk_widget_show_all(menuItem);
    }
  }
);
}

Fixed version (ground truth):
private void setImage_(final File imageFile){
  hasLegitIcon=imageFile != null;
  Gtk.dispatch(new Runnable(){
    @Override public void run(){
      if (image != null) {
        Gtk.gtk_widget_destroy(image);
        image=null;
        Gtk.gtk_widget_show_all(menuItem);
      }
      if (hasLegitIcon) {
        image=Gtk.gtk_image_new_from_file(imageFile.getAbsolutePath());
        Gtk.gtk_image_menu_item_set_image(menuItem,image);
        Gobject.g_object_ref_sink(image);
        Gtk.gtk_image_menu_item_set_always_show_image(menuItem,Gtk.TRUE);
      }
      Gtk.gtk_widget_show_all(menuItem);
    }
  }
);
}
Program: 96369
Project: 96369
Buggy source:
/** 
 * called from inside dispatch thread. ONLY creates the menu item, but DOES NOT attach it! this is a FLOATING reference. See: https://developer.gnome.org/gobject/stable/gobject-The-Base-Object-Type.html#floating-ref
 */
GtkMenuEntry(final String label,final File imagePath,final SystemTrayMenuAction callback,final GtkTypeSystemTray parent){
  this.parent=parent;
  this.text=label;
  this.callback=callback;
  menuItem=Gtk.gtk_image_menu_item_new_with_label(label);
  if (imagePath != null) {
    image=Gtk.gtk_image_new_from_file(imagePath.getAbsolutePath());
    Gtk.gtk_image_menu_item_set_image(menuItem,image);
    Gtk.gtk_image_menu_item_set_always_show_image(menuItem,Gtk.TRUE);
  }
  nativeLong=Gobject.g_signal_connect_object(menuItem,"String_Node_Str",this,null,0);
}

Fixed version (ground truth):
/** 
 * called from inside dispatch thread. ONLY creates the menu item, but DOES NOT attach it! this is a FLOATING reference. See: https://developer.gnome.org/gobject/stable/gobject-The-Base-Object-Type.html#floating-ref
 */
GtkMenuEntry(final String label,final File imagePath,final SystemTrayMenuAction callback,final GtkTypeSystemTray parent){
  this.parent=parent;
  this.text=label;
  this.callback=callback;
  menuItem=Gtk.gtk_image_menu_item_new_with_label(label);
  if (transparentIcon == null) {
    transparentIcon=ImageUtils.getTransparentImage(ImageUtils.ENTRY_SIZE);
  }
  hasLegitIcon=imagePath != null;
  if (hasLegitIcon) {
    image=Gtk.gtk_image_new_from_file(imagePath.getAbsolutePath());
    Gtk.gtk_image_menu_item_set_image(menuItem,image);
    Gtk.gtk_image_menu_item_set_always_show_image(menuItem,Gtk.TRUE);
  }
  nativeLong=Gobject.g_signal_connect_object(menuItem,"String_Node_Str",this,null,0);
}
Program: 96370
Project: 96370
Buggy source:
@Override @Deprecated public void setImage(final InputStream imageStream){
  if (imageStream == null) {
    setImage_(null);
  }
 else {
    setImage_(ImageUtils.resizeAndCache(ImageUtils.ENTRY_SIZE,imageStream));
  }
}

Fixed version (ground truth):
@Override public void setImage(final InputStream imageStream){
  if (imageStream == null) {
    setImage_(null);
  }
 else {
    setImage_(ImageUtils.resizeAndCache(ImageUtils.ENTRY_SIZE,imageStream));
  }
}
Program: 96371
Project: 96371
Buggy source:
void createMenu(){
  if (connectionStatusItem != null) {
    Gtk.gtk_menu_shell_append(this.menu,this.connectionStatusItem);
    Gobject.g_object_ref_sink(connectionStatusItem);
  }
synchronized (menuEntries) {
    for (int i=0; i < menuEntries.size(); i++) {
      GtkMenuEntry menuEntry__=(GtkMenuEntry)menuEntries.get(i);
      Gtk.gtk_menu_shell_append(this.menu,menuEntry__.menuItem);
      Gobject.g_object_ref_sink(menuEntry__.menuItem);
    }
    onMenuAdded(menu);
    Gtk.gtk_widget_show_all(menu);
  }
}

Fixed version (ground truth):
void createMenu(){
  if (connectionStatusItem != null) {
    Gtk.gtk_menu_shell_append(this.menu,this.connectionStatusItem);
    Gobject.g_object_ref_sink(connectionStatusItem);
  }
  boolean hasImages=false;
synchronized (menuEntries) {
    for (int i=0; i < menuEntries.size(); i++) {
      GtkMenuEntry menuEntry__=(GtkMenuEntry)menuEntries.get(i);
      hasImages|=menuEntry__.hasImage();
    }
    for (int i=0; i < menuEntries.size(); i++) {
      GtkMenuEntry menuEntry__=(GtkMenuEntry)menuEntries.get(i);
      menuEntry__.setSpacerImage(hasImages);
      Gtk.gtk_menu_shell_append(this.menu,menuEntry__.menuItem);
      Gobject.g_object_ref_sink(menuEntry__.menuItem);
    }
    onMenuAdded(menu);
    Gtk.gtk_widget_show_all(menu);
  }
}
Program: 96372
Project: 96372
Buggy source:
private void setImageIcon(final File imagePath){
  if (imagePath != null) {
    ImageIcon origIcon=new ImageIcon(imagePath.getAbsolutePath());
    menuItem.setIcon(origIcon);
  }
 else {
    menuItem.setIcon(null);
  }
}

Fixed version (ground truth):
private void setImageIcon(final File imagePath){
  if (imagePath != null) {
    hasLegitIcon=true;
    ImageIcon origIcon=new ImageIcon(imagePath.getAbsolutePath());
    menuItem.setIcon(origIcon);
  }
 else {
    hasLegitIcon=false;
    menuItem.setIcon(null);
  }
}
Program: 96373
Project: 96373
Buggy source:
SwingMenuEntry(final SwingSystemTrayMenuPopup parentMenu,final String label,final File imagePath,final SystemTrayMenuAction callback,final SystemTray systemTray){
  this.parent=parentMenu;
  this.text=label;
  this.callback=callback;
  this.systemTray=systemTray;
  swingCallback=new ActionListener(){
    @Override public void actionPerformed(    ActionEvent e){
      handle();
    }
  }
;
  menuItem=new JMenuItem(label);
  menuItem.addActionListener(swingCallback);
  if (imagePath != null) {
    setImageIcon(imagePath);
  }
  parentMenu.add(menuItem);
}

Fixed version (ground truth):
SwingMenuEntry(final SwingSystemTrayMenuPopup parentMenu,final String label,final File imagePath,final SystemTrayMenuAction callback,final SystemTray systemTray){
  this.parent=parentMenu;
  this.text=label;
  this.callback=callback;
  this.systemTray=systemTray;
  swingCallback=new ActionListener(){
    @Override public void actionPerformed(    ActionEvent e){
      handle();
    }
  }
;
  menuItem=new JMenuItem(label);
  menuItem.addActionListener(swingCallback);
  if (imagePath != null) {
    hasLegitIcon=true;
    setImageIcon(imagePath);
  }
  parentMenu.add(menuItem);
}
Program: 96374
Project: 96374
Buggy source:
@Override @Deprecated public void setImage(final InputStream imageStream){
  if (imageStream == null) {
    setImage_(null);
  }
 else {
    setImage_(ImageUtils.resizeAndCache(ImageUtils.ENTRY_SIZE,imageStream));
  }
}

Fixed version (ground truth):
@Override public void setImage(final InputStream imageStream){
  if (imageStream == null) {
    setImage_(null);
  }
 else {
    setImage_(ImageUtils.resizeAndCache(ImageUtils.ENTRY_SIZE,imageStream));
  }
}
Program: 96375
Project: 96375
Buggy source:
private void setImage_(final String imagePath){
  SwingUtil.invokeLater(new Runnable(){
    @Override public void run(){
      if (imagePath != null && !imagePath.isEmpty()) {
        menuItem.setIcon(new ImageIcon(imagePath));
      }
 else {
        menuItem.setIcon(null);
      }
    }
  }
);
}

Fixed version (ground truth):
private void setImage_(final String imagePath){
  SwingUtil.invokeLater(new Runnable(){
    @Override public void run(){
      setImageIcon(imagePath);
    }
  }
);
}
Program: 96376
Project: 96376
Buggy source:
SwingMenuEntry(final SwingSystemTrayMenuPopup parentMenu,final String label,final String imagePath,final SystemTrayMenuAction callback,final SystemTray systemTray){
  this.parent=parentMenu;
  this.text=label;
  this.callback=callback;
  this.systemTray=systemTray;
  swingCallback=new ActionListener(){
    @Override public void actionPerformed(    ActionEvent e){
      handle();
    }
  }
;
  menuItem=new JMenuItem(label);
  menuItem.addActionListener(swingCallback);
  if (imagePath != null && !imagePath.isEmpty()) {
    menuItem.setIcon(new ImageIcon(imagePath));
  }
  parentMenu.add(menuItem);
}

Fixed version (ground truth):
SwingMenuEntry(final SwingSystemTrayMenuPopup parentMenu,final String label,final String imagePath,final SystemTrayMenuAction callback,final SystemTray systemTray){
  this.parent=parentMenu;
  this.text=label;
  this.callback=callback;
  this.systemTray=systemTray;
  swingCallback=new ActionListener(){
    @Override public void actionPerformed(    ActionEvent e){
      handle();
    }
  }
;
  menuItem=new JMenuItem(label);
  menuItem.addActionListener(swingCallback);
  if (imagePath != null && !imagePath.isEmpty()) {
    setImageIcon(imagePath);
  }
  parentMenu.add(menuItem);
}
Program: 96377
Project: 96377
Buggy source:
public void createTrayFailed();

Fixed version (ground truth):
void createTrayFailed();
Program: 96378
Project: 96378
Buggy source:
public static SystemTray create(String appName){
  if (trayType != null) {
    try {
      SystemTray newInstance=trayType.newInstance();
      if (newInstance != null) {
        newInstance.setAppName(appName);
      }
      return newInstance;
    }
 catch (    Exception e) {
      e.printStackTrace();
    }
  }
  return null;
}

Fixed version (ground truth):
public static SystemTray create(String appName){
  if (trayType != null) {
    try {
      SystemTray newInstance=trayType.newInstance();
      if (newInstance != null) {
        newInstance.setAppName(appName);
      }
      return newInstance;
    }
 catch (    Throwable e) {
      e.printStackTrace();
    }
  }
  return null;
}
Program: 96379
Project: 96379
Buggy source:
@Override public synchronized void setIcon(final String iconName){
  libgtk.gdk_threads_enter();
  libappindicator.app_indicator_set_icon(this.appIndicator,iconPath(iconName));
  libgtk.gdk_threads_leave();
}

Fixed version (ground truth):
@Override public synchronized void setIcon(final String iconName){
  gtk.gdk_threads_enter();
  appindicator.app_indicator_set_icon(this.appIndicator,iconPath(iconName));
  gtk.gdk_threads_leave();
}
Program: 96380
Project: 96380
Buggy source:
/** 
 * Called inside the gdk_threads block. MUST BE AFTER THE ITEM IS ADDED/CHANGED from the menu
 */
protected void onMenuAdded(final Pointer menu){
  libappindicator.app_indicator_set_menu(this.appIndicator,menu);
}

Fixed version (ground truth):
/** 
 * Called inside the gdk_threads block. MUST BE AFTER THE ITEM IS ADDED/CHANGED from the menu
 */
protected void onMenuAdded(final Pointer menu){
  appindicator.app_indicator_set_menu(this.appIndicator,menu);
}
Program: 96381
Project: 96381
Buggy source:
@Override public synchronized void shutdown(){
  libgtk.gdk_threads_enter();
  libappindicator.app_indicator_set_status(this.appIndicator,AppIndicator.STATUS_PASSIVE);
  Pointer p=this.appIndicator.getPointer();
  libgobject.g_object_unref(p);
  this.appIndicator=null;
  super.shutdown();
}

Fixed version (ground truth):
@Override public synchronized void shutdown(){
  gtk.gdk_threads_enter();
  appindicator.app_indicator_set_status(this.appIndicator,AppIndicator.STATUS_PASSIVE);
  Pointer p=this.appIndicator.getPointer();
  gobject.g_object_unref(p);
  this.appIndicator=null;
  super.shutdown();
}
Program: 96382
Project: 96382
Buggy source:
public AppIndicatorTray(String iconName){
  libgtk.gdk_threads_enter();
  String icon_name=iconPath(iconName);
  this.appIndicator=libappindicator.app_indicator_new(System.nanoTime() + "String_Node_Str",icon_name,AppIndicator.CATEGORY_APPLICATION_STATUS);
  libappindicator.app_indicator_set_status(this.appIndicator,AppIndicator.STATUS_ACTIVE);
  libgtk.gdk_threads_leave();
  GtkSupport.startGui();
}

Fixed version (ground truth):
public AppIndicatorTray(String iconName){
  gtk.gdk_threads_enter();
  String icon_name=iconPath(iconName);
  this.appIndicator=appindicator.app_indicator_new(System.nanoTime() + "String_Node_Str",icon_name,AppIndicator.CATEGORY_APPLICATION_STATUS);
  appindicator.app_indicator_set_status(this.appIndicator,AppIndicator.STATUS_ACTIVE);
  gtk.gdk_threads_leave();
  GtkSupport.startGui();
}
Program: 96383
Project: 96383
Buggy source:
GtkMenuEntry(final Pointer parentMenu,final String label,final String imagePath,final SystemTrayMenuAction callback,final GtkTypeSystemTray systemTray){
  this.parentMenu=parentMenu;
  this.text=label;
  this.callback=callback;
  this.systemTray=systemTray;
  gtkCallback=new Gobject.GCallback(){
    @Override public int callback(    Pointer instance,    Pointer data){
      handle();
      return Gtk.TRUE;
    }
  }
;
  menuItem=libgtk.gtk_image_menu_item_new_with_label(label);
  if (imagePath != null && !imagePath.isEmpty()) {
    image=libgtk.gtk_image_new_from_file(imagePath);
    libgtk.gtk_image_menu_item_set_image(menuItem,image);
    libgtk.gtk_image_menu_item_set_always_show_image(menuItem,Gtk.TRUE);
  }
  nativeLong=libgobject.g_signal_connect_data(menuItem,"String_Node_Str",gtkCallback,null,null,0);
}

Fixed version (ground truth):
GtkMenuEntry(final Pointer parentMenu,final String label,final String imagePath,final SystemTrayMenuAction callback,final GtkTypeSystemTray systemTray){
  this.parentMenu=parentMenu;
  this.text=label;
  this.callback=callback;
  this.systemTray=systemTray;
  gtkCallback=new Gobject.GCallback(){
    @Override public int callback(    Pointer instance,    Pointer data){
      handle();
      return Gtk.TRUE;
    }
  }
;
  menuItem=gtk.gtk_image_menu_item_new_with_label(label);
  if (imagePath != null && !imagePath.isEmpty()) {
    image=gtk.gtk_image_new_from_file(imagePath);
    gtk.gtk_image_menu_item_set_image(menuItem,image);
    gtk.gtk_image_menu_item_set_always_show_image(menuItem,Gtk.TRUE);
  }
  nativeLong=gobject.g_signal_connect_data(menuItem,"String_Node_Str",gtkCallback,null,null,0);
}
Program: 96384
Project: 96384
Buggy source:
void removePrivate(){
  libgobject.g_signal_handler_disconnect(menuItem,nativeLong);
  libgtk.gtk_menu_shell_deactivate(parentMenu,menuItem);
  if (image != null) {
    libgtk.gtk_widget_destroy(image);
  }
  libgtk.gtk_widget_destroy(menuItem);
}

Fixed version (ground truth):
void removePrivate(){
  gobject.g_signal_handler_disconnect(menuItem,nativeLong);
  gtk.gtk_menu_shell_deactivate(parentMenu,menuItem);
  if (image != null) {
    gtk.gtk_widget_destroy(image);
  }
  gtk.gtk_widget_destroy(menuItem);
}
Program: 96385
Project: 96385
Buggy source:
/** 
 * This is ONLY called via systray.menuEntry.remove() !!
 */
public void remove(){
  libgtk.gdk_threads_enter();
  removePrivate();
  systemTray.deleteMenu();
  systemTray.createMenu();
  libgtk.gdk_threads_leave();
}

Fixed version (ground truth):
/** 
 * This is ONLY called via systray.menuEntry.remove() !!
 */
public void remove(){
  gtk.gdk_threads_enter();
  removePrivate();
  systemTray.deleteMenu();
  systemTray.createMenu();
  gtk.gdk_threads_leave();
}
Program: 96386
Project: 96386
Buggy source:
@Override public void setText(final String newText){
  this.text=newText;
  libgtk.gdk_threads_enter();
  libgtk.gtk_menu_item_set_label(menuItem,newText);
  libgtk.gtk_widget_show_all(parentMenu);
  libgtk.gdk_threads_leave();
}

Fixed version (ground truth):
@Override public void setText(final String newText){
  this.text=newText;
  gtk.gdk_threads_enter();
  gtk.gtk_menu_item_set_label(menuItem,newText);
  gtk.gtk_widget_show_all(parentMenu);
  gtk.gdk_threads_leave();
}
Program: 96387
Project: 96387
Buggy source:
@Override public void setImage(final String imagePath){
  libgtk.gdk_threads_enter();
  if (imagePath != null && !imagePath.isEmpty()) {
    if (image != null) {
      libgtk.gtk_widget_destroy(image);
    }
    libgtk.gtk_widget_show_all(parentMenu);
    libgtk.gdk_threads_leave();
    libgtk.gdk_threads_enter();
    image=libgtk.gtk_image_new_from_file(imagePath);
    libgtk.gtk_image_menu_item_set_image(menuItem,image);
    libgtk.gtk_image_menu_item_set_always_show_image(menuItem,Gtk.TRUE);
  }
  libgtk.gtk_widget_show_all(parentMenu);
  libgtk.gdk_threads_leave();
}

Fixed version (ground truth):
@Override public void setImage(final String imagePath){
  gtk.gdk_threads_enter();
  if (imagePath != null && !imagePath.isEmpty()) {
    if (image != null) {
      gtk.gtk_widget_destroy(image);
    }
    gtk.gtk_widget_show_all(parentMenu);
    image=gtk.gtk_image_new_from_file(imagePath);
    gtk.gtk_image_menu_item_set_image(menuItem,image);
    gtk.gtk_image_menu_item_set_always_show_image(menuItem,Gtk.TRUE);
  }
  gtk.gdk_threads_leave();
  gtk.gtk_widget_show_all(parentMenu);
}
Program: 96388
Project: 96388
Buggy source:
@Override public synchronized void setIcon(final String iconName){
  libgtk.gdk_threads_enter();
  libgtk.gtk_status_icon_set_from_file(trayIcon,iconPath(iconName));
  libgtk.gdk_threads_leave();
}

Fixed version (ground truth):
@Override public synchronized void setIcon(final String iconName){
  gtk.gdk_threads_enter();
  gtk.gtk_status_icon_set_from_file(trayIcon,iconPath(iconName));
  gtk.gdk_threads_leave();
}
Program: 96389
Project: 96389
Buggy source:
@Override public void callback(Pointer notUsed,final Gtk.GdkEventButton event){
  if (event.type == 4) {
    libgtk.gtk_menu_popup(menu,null,null,Gtk.gtk_status_icon_position_menu,trayIcon,0,event.time);
  }
}

Fixed version (ground truth):
@Override public void callback(Pointer notUsed,final Gtk.GdkEventButton event){
  if (event.type == 4) {
    gtk.gtk_menu_popup(menu,null,null,Gtk.gtk_status_icon_position_menu,trayIcon,0,event.time);
  }
}
Program: 96390
Project: 96390
Buggy source:
public GtkSystemTray(String iconName){
  super();
  libgtk.gdk_threads_enter();
  final Pointer trayIcon=libgtk.gtk_status_icon_new();
  libgtk.gtk_status_icon_set_title(trayIcon,"String_Node_Str");
  libgtk.gtk_status_icon_set_name(trayIcon,"String_Node_Str");
  this.trayIcon=trayIcon;
  libgtk.gtk_status_icon_set_from_file(trayIcon,iconPath(iconName));
  this.gtkCallback=new Gobject.GEventCallback(){
    @Override public void callback(    Pointer notUsed,    final Gtk.GdkEventButton event){
      if (event.type == 4) {
        libgtk.gtk_menu_popup(menu,null,null,Gtk.gtk_status_icon_position_menu,trayIcon,0,event.time);
      }
    }
  }
;
  button_press_event=libgobject.g_signal_connect_data(trayIcon,"String_Node_Str",gtkCallback,null,null,0);
  libgtk.gtk_status_icon_set_visible(trayIcon,true);
  libgtk.gdk_threads_leave();
  GtkSupport.startGui();
}

Fixed version (ground truth):
public GtkSystemTray(String iconName){
  super();
  gtk.gdk_threads_enter();
  final Pointer trayIcon=gtk.gtk_status_icon_new();
  gtk.gtk_status_icon_set_title(trayIcon,"String_Node_Str");
  gtk.gtk_status_icon_set_name(trayIcon,"String_Node_Str");
  this.trayIcon=trayIcon;
  gtk.gtk_status_icon_set_from_file(trayIcon,iconPath(iconName));
  this.gtkCallback=new Gobject.GEventCallback(){
    @Override public void callback(    Pointer notUsed,    final Gtk.GdkEventButton event){
      if (event.type == 4) {
        gtk.gtk_menu_popup(menu,null,null,Gtk.gtk_status_icon_position_menu,trayIcon,0,event.time);
      }
    }
  }
;
  button_press_event=gobject.g_signal_connect_data(trayIcon,"String_Node_Str",gtkCallback,null,null,0);
  gtk.gtk_status_icon_set_visible(trayIcon,true);
  gtk.gdk_threads_leave();
  GtkSupport.startGui();
}
Program: 96391
Project: 96391
Buggy source:
@SuppressWarnings("String_Node_Str") @Override public synchronized void shutdown(){
  libgtk.gdk_threads_enter();
  libgtk.gtk_status_icon_set_visible(this.trayIcon,false);
  libgobject.g_object_unref(this.trayIcon);
  this.trayIcon=null;
  super.shutdown();
}

Fixed version (ground truth):
@SuppressWarnings("String_Node_Str") @Override public synchronized void shutdown(){
  gtk.gdk_threads_enter();
  gtk.gtk_status_icon_set_visible(this.trayIcon,false);
  gobject.g_object_unref(this.trayIcon);
  this.trayIcon=null;
  super.shutdown();
}