until we actually get somewhere with the menu crap... fix potential crashes when exiting.

This commit is contained in:
StapleButter
2018-10-26 18:39:41 +02:00
parent c5670a22a5
commit cbe63f8fd5
3 changed files with 34 additions and 10 deletions

View File

@ -77,6 +77,10 @@ static void areaWidget_init(areaWidget *aw)
static void areaWidget_dispose(GObject *obj)
{
// remove any draw order that might still be pending
areaWidget *aw = areaWidget(obj);
while (g_idle_remove_by_data(aw->a));
G_OBJECT_CLASS(areaWidget_parent_class)->dispose(obj);
}

View File

@ -13,7 +13,6 @@ struct uiMenu {
GArray *items; // []*uiMenuItem
gboolean ischild;
guint id;
gboolean freed;
};
struct uiMenuItem {
@ -100,6 +99,22 @@ static void menuItemEnableDisable(uiMenuItem *item, gboolean enabled)
g_hash_table_iter_init(&iter, item->windows);
while (g_hash_table_iter_next(&iter, &widget, NULL))
gtk_widget_set_sensitive(GTK_WIDGET(widget), enabled);
// extra crummy code for disabling submenus
// TODO: find a better way to do it!!!!!!!!!!!!!!!!!!!!!!!!!!
// noting that:
// * set_sensitive on the menu item does nothing (herpderp)
// * set_sensitive on the submenu disables all the submenu items at once (but then you can't fucking enable them back!!)
// * googling gives no results, guess nobody has ever wanted to do this shit or...??????
// * under Windows we can just disable the menu item and call it good! works exactly as intended!
// * fucking stupid pile of shit
/*if (item->popupchild != NULL)
{
g_hash_table_iter_init(&iter, item->windows);
while (g_hash_table_iter_next(&iter, &widget, NULL))
gtk_widget_set_sensitive(GTK_WIDGET(gtk_menu_item_get_submenu(widget)), enabled);
}*/
}
void uiMenuItemEnable(uiMenuItem *item)
@ -276,7 +291,6 @@ uiMenu *uiNewMenu(const char *name)
m->name = g_strdup(name);
m->items = g_array_new(FALSE, TRUE, sizeof (uiMenuItem *));
m->ischild = FALSE;
m->freed = FALSE;
return m;
}