[gaim-migrate @ 3270]

Wed, 15 May 2002 02:28:01 +0000

author
Jim Seymour <jseymour@users.sourceforge.net>
date
Wed, 15 May 2002 02:28:01 +0000
changeset 3252
e244391c28e8
parent 3251
360fb695996d
child 3253
9bb01aa48371

[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.

src/gtkspell.c file | annotate | diff | comparison | revisions
--- 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);

mercurial