From f086b1b603ce15825abf0f83d6f1bb09e2116dc7 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Jan=20Dj=C3=A4rv?= Date: Mon, 27 Jan 2003 18:47:01 +0000 Subject: [PATCH] lwlib-Xm.c: Fixed memory leak for menus. --- lwlib/ChangeLog | 6 ++++++ lwlib/lwlib-Xm.c | 8 +++++++- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/lwlib/ChangeLog b/lwlib/ChangeLog index 1f7338784ce..6193f8ecf99 100644 --- a/lwlib/ChangeLog +++ b/lwlib/ChangeLog @@ -1,3 +1,9 @@ +2003-01-27 Jan Dj,Ad(Brv + + * lwlib-Xm.c (update_one_menu_entry): Deallocate widget_list. + (destroy_all_children): Call it self to destroy sub menu children. + + 2002-03-16 Eli Zaretskii * Version 21.2 released. diff --git a/lwlib/lwlib-Xm.c b/lwlib/lwlib-Xm.c index 766d3554e24..8aa08187e4c 100644 --- a/lwlib/lwlib-Xm.c +++ b/lwlib/lwlib-Xm.c @@ -265,7 +265,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]); } @@ -731,6 +734,9 @@ update_one_menu_entry (instance, widget, val, deep_p) (XtPointer)instance); XtManageChild (button); } + + if (widget_list) + XtFree ((char*) widget_list); } } else if (!contents) -- 2.39.2