diff src/conversation.c @ 3250:0970eabdd8df

[gaim-migrate @ 3268] Eliminated memory leaks resulting from the way pop-up menus are used. committer: Tailor Script <tailor@pidgin.im>
author Jim Seymour <jseymour>
date Wed, 15 May 2002 02:21:21 +0000
parents 265a3c9d0557
children 6190cf2c95a9
line wrap: on
line diff
--- a/src/conversation.c	Tue May 14 18:24:30 2002 +0000
+++ b/src/conversation.c	Wed May 15 02:21:21 2002 +0000
@@ -3441,7 +3441,7 @@
 
 static gboolean icon_menu(GtkObject *obj, GdkEventButton *e, struct conversation *c)
 {
-	GtkWidget *menu;
+	static GtkWidget *menu = NULL;
 	GtkWidget *button;
 
 	if (e->button != 3)
@@ -3449,6 +3449,13 @@
 	if (e->type != GDK_BUTTON_PRESS)
 		return FALSE;
 
+	/*
+	 * 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();
 
 	if (c->icon_timer) {