diff options
| author | StapleButter <thetotalworm@gmail.com> | 2018-10-26 18:39:41 +0200 | 
|---|---|---|
| committer | StapleButter <thetotalworm@gmail.com> | 2018-10-26 18:39:41 +0200 | 
| commit | cbe63f8fd5285022ad3917a675b08b49ee20853c (patch) | |
| tree | f4dc74f74968ffe70cbf4e2af38d128cc51e35ed /src/libui_sdl/libui | |
| parent | c5670a22a59d27d7f4e91c9dd38346ce7288115b (diff) | |
until we actually get somewhere with the menu crap... fix potential crashes when exiting.
Diffstat (limited to 'src/libui_sdl/libui')
| -rw-r--r-- | src/libui_sdl/libui/unix/area.c | 4 | ||||
| -rw-r--r-- | src/libui_sdl/libui/unix/menu.c | 18 | 
2 files changed, 20 insertions, 2 deletions
diff --git a/src/libui_sdl/libui/unix/area.c b/src/libui_sdl/libui/unix/area.c index ea31676..40f8624 100644 --- a/src/libui_sdl/libui/unix/area.c +++ b/src/libui_sdl/libui/unix/area.c @@ -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);  } diff --git a/src/libui_sdl/libui/unix/menu.c b/src/libui_sdl/libui/unix/menu.c index aa6458f..07cd7b3 100644 --- a/src/libui_sdl/libui/unix/menu.c +++ b/src/libui_sdl/libui/unix/menu.c @@ -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;  }  |