changeset 3252:0f8e4835d938

[gaim-migrate @ 3270] Eliminated memory leaks resulting from the way pop-up menus are used. Removed a couple variables that were no longer used and should have been removed when SIGCHLD changes were made. committer: Tailor Script <tailor@pidgin.im>
author Jim Seymour <jseymour>
date Wed, 15 May 2002 02:28:01 +0000
parents b3c7af7286de
children 822d621dd325
files src/gtkspell.c
diffstat 1 files changed, 10 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/src/gtkspell.c	Wed May 15 02:26:03 2002 +0000
+++ b/src/gtkspell.c	Wed May 15 02:28:01 2002 +0000
@@ -45,14 +45,12 @@
  */
 static pid_t spell_pid = -1;
 static int fd_write[2] = {0}, fd_read[2] = {0};
-static int signal_set_up = 0;
 
 /* FIXME? */
 static GdkColor highlight = { 0, 255*256, 0, 0 };
 
 static void entry_insert_cb(GtkText *gtktext, 
 		gchar *newtext, guint len, guint *ppos, gpointer d);
-static void set_up_signal();
 
 int gtkspell_running() {
 	return (spell_pid > 0? spell_pid : 0);
@@ -550,8 +548,17 @@
 }
 
 static GtkMenu *make_menu(GList *l, GtkText *gtktext) {
-	GtkWidget *menu, *item;
+	static GtkWidget *menu = NULL;
+	GtkWidget *item;
 	char *caption;
+
+	/*
+	 * If a menu already exists, destroy it before creating a new one,
+	 * thus freeing-up the memory it occupied.
+	 */
+	if(menu)
+		gtk_widget_destroy(menu);
+
 	menu = gtk_menu_new(); {
 		caption = g_strdup_printf("Not in dictionary: %s", (char*)l->data);
 		item = gtk_menu_item_new_with_label(caption);