changeset 49460:9f4069f735c6

lwlib-Xm.c: Fixed memory leak for menus.
author Jan Djärv <jan.h.d@swipnet.se>
date Sun, 26 Jan 2003 13:06:48 +0000
parents 06b77df47802
children f00b6ec56900
files lwlib/ChangeLog lwlib/lwlib-Xm.c
diffstat 2 files changed, 13 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- 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.  <jan.h.d@swipnet.se>
+
+	* 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  <rms@gnu.org>
 
 	* xlwmenu.c (pop_new_stack_if_no_contents): Do nothing if
--- 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);