Program: 96393
Project: 96393
Buggy source:
@Override public void createTray(String iconName){
  libgtk.gdk_threads_enter();
  this.trayIcon=libgtk.gtk_status_icon_new();
  libgtk.gtk_status_icon_set_from_file(this.trayIcon,iconPath(iconName));
  libgtk.gtk_status_icon_set_tooltip(this.trayIcon,this.appName);
  libgtk.gtk_status_icon_set_visible(this.trayIcon,true);
  Gobject.GEventCallback gtkCallback=new Gobject.GEventCallback(){
    @Override public void callback(    Pointer instance,    final GdkEventButton event){
      if (event.type == 4) {
        SwingUtil.invokeLater(new Runnable(){
          @Override public void run(){
            if (GtkSystemTray.this.jmenu.isVisible()) {
              GtkSystemTray.this.jmenu.setVisible(false);
            }
 else {
              int iconX=(int)(event.x_root - event.x);
              int iconY=(int)(event.y_root - event.y);
              Dimension size=GtkSystemTray.this.jmenu.getPreferredSize();
              iconX-=size.width / 2;
              if (iconY > 240) {
                iconY-=size.height;
              }
 else {
                iconY+=ICON_SIZE;
              }
              GtkSystemTray.this.jmenu.setInvoker(GtkSystemTray.this.jmenu);
              GtkSystemTray.this.jmenu.setLocation(iconX,iconY);
              GtkSystemTray.this.jmenu.setVisible(true);
            }
          }
        }
);
      }
    }
  }
;
  libgobject.g_signal_connect_data(this.trayIcon,"String_Node_Str",gtkCallback,null,null,0);
  libgtk.gdk_threads_leave();
  SwingUtil.invokeAndWait(new Runnable(){
    @Override public void run(){
      GtkSystemTray.this.jmenu=new SystemTrayMenuPopup();
    }
  }
);
  if (!useSWT) {
    Thread gtkUpdateThread=new Thread(){
      @Override public void run(){
        GtkSystemTray.this.blockUntilStarted.countDown();
        libgtk.gtk_main();
      }
    }
;
    gtkUpdateThread.setName("String_Node_Str");
    gtkUpdateThread.start();
  }
  try {
    this.blockUntilStarted.await();
    this.active=true;
  }
 catch (  InterruptedException ignored) {
  }
}

Fixed version (ground truth):
@Override public void createTray(String iconName){
  libgtk.gdk_threads_enter();
  this.trayIcon=libgtk.gtk_status_icon_new();
  libgtk.gtk_status_icon_set_from_file(this.trayIcon,iconPath(iconName));
  libgtk.gtk_status_icon_set_tooltip(this.trayIcon,this.appName);
  libgtk.gtk_status_icon_set_visible(this.trayIcon,true);
  Gobject.GEventCallback gtkCallback=new Gobject.GEventCallback(){
    @Override public void callback(    Pointer instance,    final GdkEventButton event){
      if (event.type == 4) {
        SwingUtil.invokeLater(new Runnable(){
          @Override public void run(){
            if (GtkSystemTray.this.jmenu.isVisible()) {
              GtkSystemTray.this.jmenu.setVisible(false);
            }
 else {
              int iconX=(int)(event.x_root - event.x);
              int iconY=(int)(event.y_root - event.y);
              Dimension size=GtkSystemTray.this.jmenu.getPreferredSize();
              iconX-=size.width / 2;
              if (iconY > 240) {
                iconY-=size.height;
              }
 else {
                iconY+=ICON_SIZE;
              }
              GtkSystemTray.this.jmenu.setInvoker(GtkSystemTray.this.jmenu);
              GtkSystemTray.this.jmenu.setLocation(iconX,iconY);
              GtkSystemTray.this.jmenu.setVisible(true);
            }
          }
        }
);
      }
    }
  }
;
  libgobject.g_signal_connect_data(this.trayIcon,"String_Node_Str",gtkCallback,null,null,0);
  libgtk.gdk_threads_leave();
  SwingUtil.invokeAndWait(new Runnable(){
    @Override public void run(){
      GtkSystemTray.this.jmenu=new SystemTrayMenuPopup();
    }
  }
);
  this.active=true;
}