# HG changeset patch # User Richard M. Stallman # Date 828552177 0 # Node ID 0706926a11cb1b097bc9ca7a9629ab9e506f11fe # Parent 382c7659273effabd4ed316b6e53d73f2d8b6079 (destroy_all_children): When freeing a cascade button, free its submenu too. (make_menu_in_widget): Use a cascade button gadget, not a widget. Include Xm/CascadeBG.h. diff -r 382c7659273e -r 0706926a11cb lwlib/lwlib-Xm.c --- a/lwlib/lwlib-Xm.c Wed Apr 03 17:22:11 1996 +0000 +++ b/lwlib/lwlib-Xm.c Wed Apr 03 17:22:57 1996 +0000 @@ -34,6 +34,7 @@ #include #include +#include #include #include #include @@ -168,7 +169,20 @@ /* Unmanage all children and destroy them. They will only be really destroyed when we get out of DispatchEvent. */ for (i = first_child_to_destroy; i < number; i++) - XtDestroyWidget (children[i]); + { + Arg al[2]; + Widget submenu = 0; + /* Cascade buttons have submenus,and these submenus + need to be freed. But they are not included in + XtCompositeChildren. So get it out of the cascade button + and free it. If this child is not a cascade button, + then submenu should remain unchanged. */ + XtSetArg (al[0], XmNsubMenuId, &submenu); + XtGetValues (children[i], al, 1); + if (submenu) + XtDestroyWidget (submenu); + XtDestroyWidget (children[i]); + } XtFree ((char *) children); } @@ -427,7 +441,7 @@ menu = XmCreatePulldownMenu (widget, cur->name, NULL, 0); make_menu_in_widget (instance, menu, cur->contents, 0); XtSetArg (al [ac], XmNsubMenuId, menu); ac++; - button = XmCreateCascadeButton (widget, cur->name, al, ac); + button = XmCreateCascadeButtonGadget (widget, cur->name, al, ac); xm_update_label (instance, button, cur);