Fixed order of destroying widgets

This commit is contained in:
nathan 2016-09-28 18:33:29 +02:00
parent 280da3b0b0
commit e30033c7ff

View File

@ -138,25 +138,20 @@ class GtkMenuEntry implements MenuEntry {
} }
/** /**
* This is ONLY called via systray.menuEntry.remove() !! * will always be on the dispatch thread
*/ */
public final public final
void remove() { void remove() {
Gtk.dispatch(new Runnable() { Gtk.gtk_container_remove(systemTray.getMenu(), menuItem);
@Override Gtk.gtk_menu_shell_deactivate(systemTray.getMenu(), menuItem);
public
void run() {
Gtk.gtk_container_remove(systemTray.getMenu(), menuItem);
Gtk.gtk_menu_shell_deactivate(systemTray.getMenu(), menuItem);
Gtk.gtk_widget_destroy(menuItem);
removePrivate(); removePrivate();
// have to rebuild the menu now... Gtk.gtk_widget_destroy(menuItem);
systemTray.deleteMenu();
systemTray.createMenu(); // have to rebuild the menu now...
} systemTray.deleteMenu();
}); systemTray.createMenu();
} }
// called when this item is removed. Necessary to cleanup/remove itself // called when this item is removed. Necessary to cleanup/remove itself