Index: src_plugins/hid_lesstif/main.c =================================================================== --- src_plugins/hid_lesstif/main.c (revision 8769) +++ src_plugins/hid_lesstif/main.c (revision 8770) @@ -3708,6 +3708,7 @@ #include "dolists.h" void lesstif_create_menu(const char *menu, const char *action, const char *mnemonic, const char *accel, const char *tip, const char *cookie); +void lesstif_remove_menu(const char *menu); int pplg_check_ver_hid_lesstif(int version_we_need) { return 0; } @@ -3787,6 +3788,7 @@ lesstif_hid.finish_debug_draw = lesstif_finish_debug_draw; lesstif_hid.create_menu = lesstif_create_menu; + lesstif_hid.remove_menu = lesstif_remove_menu; lesstif_hid.usage = lesstif_usage; pcb_event_bind(PCB_EVENT_BOARD_CHANGED, ev_pcb_changed, NULL, lesstif_cookie); Index: src_plugins/hid_lesstif/menu.c =================================================================== --- src_plugins/hid_lesstif/menu.c (revision 8769) +++ src_plugins/hid_lesstif/menu.c (revision 8770) @@ -673,6 +673,27 @@ Widget btn; /* the button in the menu line */ } menu_data_t; +static int del_menu(void *ctx, lht_node_t *node) +{ + menu_data_t *md = node->user_data; + + if (md == NULL) + return 0; + + if (md->sub != NULL) { + XtUnmanageChild(md->sub); + XtDestroyWidget(md->sub); + } + if (md->btn != NULL) { + XtUnmanageChild(md->btn); + XtDestroyWidget(md->btn); + } + free(md); + + node->user_data = NULL; + return 0; +} + static void add_res2menu_main(Widget menu, lht_node_t *node, XtCallbackProc callback) { menu_data_t *md; @@ -907,6 +928,10 @@ pcb_hid_cfg_create_menu(lesstif_cfg, menu_path, action, mnemonic, accel, tip, cookie, lesstif_create_menu_widget, NULL); } +void lesstif_remove_menu(const char *menu_path) +{ + pcb_hid_cfg_remove_menu(lesstif_cfg, menu_path, del_menu, NULL); +} void lesstif_uninit_menu(void) {