fix GTK menus asploding upon exit. hopefully. fuck this code
This commit is contained in:
parent
65bba8ff81
commit
c5670a22a5
|
@ -13,6 +13,7 @@ struct uiMenu {
|
||||||
GArray *items; // []*uiMenuItem
|
GArray *items; // []*uiMenuItem
|
||||||
gboolean ischild;
|
gboolean ischild;
|
||||||
guint id;
|
guint id;
|
||||||
|
gboolean freed;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct uiMenuItem {
|
struct uiMenuItem {
|
||||||
|
@ -275,6 +276,7 @@ uiMenu *uiNewMenu(const char *name)
|
||||||
m->name = g_strdup(name);
|
m->name = g_strdup(name);
|
||||||
m->items = g_array_new(FALSE, TRUE, sizeof (uiMenuItem *));
|
m->items = g_array_new(FALSE, TRUE, sizeof (uiMenuItem *));
|
||||||
m->ischild = FALSE;
|
m->ischild = FALSE;
|
||||||
|
m->freed = FALSE;
|
||||||
|
|
||||||
return m;
|
return m;
|
||||||
}
|
}
|
||||||
|
@ -347,6 +349,7 @@ GtkWidget *makeMenubar(uiWindow *w)
|
||||||
struct freeMenuItemData {
|
struct freeMenuItemData {
|
||||||
GArray *items;
|
GArray *items;
|
||||||
guint i;
|
guint i;
|
||||||
|
guint* parent_i;
|
||||||
};
|
};
|
||||||
|
|
||||||
static void freeMenu(GtkWidget *widget, gpointer data);
|
static void freeMenu(GtkWidget *widget, gpointer data);
|
||||||
|
@ -359,7 +362,7 @@ static void freeMenuItem(GtkWidget *widget, gpointer data)
|
||||||
|
|
||||||
item = g_array_index(fmi->items, uiMenuItem *, fmi->i);
|
item = g_array_index(fmi->items, uiMenuItem *, fmi->i);
|
||||||
if (item->popupchild != NULL)
|
if (item->popupchild != NULL)
|
||||||
freeMenu(widget, &item->popupchild->id);
|
freeMenu(widget, fmi->parent_i);//&item->popupchild->id);
|
||||||
w = (struct menuItemWindow *) g_hash_table_lookup(item->windows, widget);
|
w = (struct menuItemWindow *) g_hash_table_lookup(item->windows, widget);
|
||||||
if (g_hash_table_remove(item->windows, widget) == FALSE)
|
if (g_hash_table_remove(item->windows, widget) == FALSE)
|
||||||
implbug("GtkMenuItem %p not in menu item's item/window map", widget);
|
implbug("GtkMenuItem %p not in menu item's item/window map", widget);
|
||||||
|
@ -380,8 +383,10 @@ static void freeMenu(GtkWidget *widget, gpointer data)
|
||||||
submenu = gtk_menu_item_get_submenu(item);
|
submenu = gtk_menu_item_get_submenu(item);
|
||||||
fmi.items = m->items;
|
fmi.items = m->items;
|
||||||
fmi.i = 0;
|
fmi.i = 0;
|
||||||
gtk_container_foreach(GTK_CONTAINER(submenu), freeMenuItem, &fmi);
|
|
||||||
(*i)++;
|
(*i)++;
|
||||||
|
fmi.parent_i = i;
|
||||||
|
gtk_container_foreach(GTK_CONTAINER(submenu), freeMenuItem, &fmi);
|
||||||
|
//(*i)++;
|
||||||
}
|
}
|
||||||
|
|
||||||
void freeMenubar(GtkWidget *mb)
|
void freeMenubar(GtkWidget *mb)
|
||||||
|
|
Loading…
Reference in New Issue