From: Jim S. <jse...@us...> - 2002-05-15 02:28:04
|
Update of /cvsroot/gaim/gaim/src In directory usw-pr-cvs1:/tmp/cvs-serv13938/src Modified Files: gtkspell.c Log Message: 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. Index: gtkspell.c =================================================================== RCS file: /cvsroot/gaim/gaim/src/gtkspell.c,v retrieving revision 1.16 retrieving revision 1.17 diff -u -d -r1.16 -r1.17 --- gtkspell.c 28 Mar 2002 20:07:45 -0000 1.16 +++ gtkspell.c 15 May 2002 02:28:01 -0000 1.17 @@ -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); |