Mercurial > pidgin
diff src/gtkimhtml.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 | 2215aa4fabdb |
| children | 3cd2fbddf95a |
line wrap: on
line diff
--- a/src/gtkimhtml.c Tue May 14 18:24:30 2002 +0000 +++ b/src/gtkimhtml.c Wed May 15 02:21:21 2002 +0000 @@ -1764,9 +1764,18 @@ uw = click->data; if ((x > uw->x) && (x < uw->x + uw->width) && (y > uw->y) && (y < uw->y + uw->height)) { - GtkWidget *menu = gtk_menu_new (); + static GtkWidget *menu = NULL; GtkWidget *button; + /* + * 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 (uw->bit->url) { button = gtk_menu_item_new_with_label ("Open URL"); gtk_signal_connect (GTK_OBJECT (button), "activate",
