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,26 +138,21 @@ 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() {
@Override
public
void run() {
Gtk.gtk_container_remove(systemTray.getMenu(), menuItem); Gtk.gtk_container_remove(systemTray.getMenu(), menuItem);
Gtk.gtk_menu_shell_deactivate(systemTray.getMenu(), menuItem); Gtk.gtk_menu_shell_deactivate(systemTray.getMenu(), menuItem);
Gtk.gtk_widget_destroy(menuItem);
removePrivate(); removePrivate();
Gtk.gtk_widget_destroy(menuItem);
// have to rebuild the menu now... // have to rebuild the menu now...
systemTray.deleteMenu(); systemTray.deleteMenu();
systemTray.createMenu(); systemTray.createMenu();
} }
});
}
// called when this item is removed. Necessary to cleanup/remove itself // called when this item is removed. Necessary to cleanup/remove itself
abstract abstract