From d0bdb0602c9c73e1aa2d9d6de7680352c47eeb38 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Jan=20Dj=C3=A4rv?= Date: Sun, 26 Jan 2003 13:06:48 +0000 Subject: [PATCH] lwlib-Xm.c: Fixed memory leak for menus. --- lwlib/ChangeLog | 5 +++++ lwlib/lwlib-Xm.c | 10 ++++++++-- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/lwlib/ChangeLog b/lwlib/ChangeLog index 6649f0960d..5f3ce50f86 100644 --- a/lwlib/ChangeLog +++ b/lwlib/ChangeLog @@ -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 --git a/lwlib/lwlib-Xm.c b/lwlib/lwlib-Xm.c index c55aa47324..f61b72534d 100644 --- a/lwlib/lwlib-Xm.c +++ b/lwlib/lwlib-Xm.c @@ -268,7 +268,10 @@ destroy_all_children (widget, first_child_to_destroy) 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 @@ update_one_menu_entry (instance, widget, val, deep_p) (XtPointer)instance); XtManageChild (button); } + + if (widget_list) + XtFree ((char*) widget_list); } } else if (!contents) @@ -813,7 +819,7 @@ xm_update_menu (instance, widget, val, deep_p) { 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); -- 2.39.2