# HG changeset patch # User Jan Dj¸«£rv # Date 1043586408 0 # Node ID 9f4069f735c67c9b45703261c1d960ec923ac467 # Parent 06b77df47802ae0b90bbf195203e09c01f7851c2 lwlib-Xm.c: Fixed memory leak for menus. diff -r 06b77df47802 -r 9f4069f735c6 lwlib/ChangeLog --- a/lwlib/ChangeLog Sun Jan 26 02:38:37 2003 +0000 +++ b/lwlib/ChangeLog Sun Jan 26 13:06:48 2003 +0000 @@ -1,3 +1,8 @@ +2003-01-26 Jan D. + + * lwlib-Xm.c (update_one_menu_entry): Deallocate widget_list. + (destroy_all_children): Call it self to destroy sub menu children. + 2002-12-22 Richard M. Stallman * xlwmenu.c (pop_new_stack_if_no_contents): Do nothing if diff -r 06b77df47802 -r 9f4069f735c6 lwlib/lwlib-Xm.c --- a/lwlib/lwlib-Xm.c Sun Jan 26 02:38:37 2003 +0000 +++ b/lwlib/lwlib-Xm.c Sun Jan 26 13:06:48 2003 +0000 @@ -268,7 +268,10 @@ XtSetArg (al[0], XmNsubMenuId, &submenu); XtGetValues (children[i], al, 1); if (submenu) - XtDestroyWidget (submenu); + { + destroy_all_children (submenu, 0); + XtDestroyWidget (submenu); + } XtDestroyWidget (children[i]); } @@ -734,6 +737,9 @@ (XtPointer)instance); XtManageChild (button); } + + if (widget_list) + XtFree ((char*) widget_list); } } else if (!contents) @@ -813,7 +819,7 @@ { destroy_all_children (widget, num_children_to_keep); make_menu_in_widget (instance, widget, val->contents, - num_children_to_keep); + num_children_to_keep); } XtFree ((char *) children);