gnome_popup_menu_new leak?



Hi All,

Could someone tell me if there are any known bugs in gnome_popup_menu_new?
It seems to be leaking quiet badly. I've attached a small test program,
compile with:
gcc ttmenu.c `gnome-config gnomeui --libs --cflags` -o ttmenu

Leaving the program running for about 1 minute will cause RSS to rise to
10meg+ and increase X's size by another 10meg.

Is it a gnome-libs bug or am I doing something wrong? My guess is that it's
leaking the stock pixmaps.

-- 
Peter Zelezny. <zed linux com>
#include <gnome.h>

GtkWidget *menu = NULL;

static GnomeUIInfo gnome_menu[] = {
	{
	 GNOME_APP_UI_ITEM,
	 "Label1", 0,
	 0, 0, 0,
	 GNOME_APP_PIXMAP_STOCK, GNOME_STOCK_MENU_BOOK_RED,
	 0, 0, 0},
	{
	 GNOME_APP_UI_ITEM,
	 "Label2", 0,
	 0, 0, 0,
	 GNOME_APP_PIXMAP_STOCK, GNOME_STOCK_MENU_BOOK_GREEN,
	 0, 0, 0},
	{
	 GNOME_APP_UI_ITEM,
	 "Label3", 0,
	 0, 0, 0,
	 GNOME_APP_PIXMAP_STOCK, GNOME_STOCK_MENU_BOOK_BLUE,
	 0, 0, 0},
	{
	 GNOME_APP_UI_ITEM,
	 "Label4", 0,
	 0, 0, 0,
	 GNOME_APP_PIXMAP_STOCK, GNOME_STOCK_MENU_UP,
	 0, 0, 0},
	{
	 GNOME_APP_UI_ITEM,
	 "Label5", 0,
	 0, 0, 0,
	 GNOME_APP_PIXMAP_STOCK, GNOME_STOCK_MENU_DOWN,
	 0, 0, 0},
	{
	 GNOME_APP_UI_ITEM,
	 "Label4", 0,
	 0, 0, 0,
	 GNOME_APP_PIXMAP_STOCK, GNOME_STOCK_MENU_FORWARD,
	 0, 0, 0},
	{
	 GNOME_APP_UI_ITEM,
	 "Label5", 0,
	 0, 0, 0,
	 GNOME_APP_PIXMAP_STOCK, GNOME_STOCK_MENU_BACK,
	 0, 0, 0},
	GNOMEUIINFO_SEPARATOR
};

static GnomeUIInfo sub2[] = {
	{
	 GNOME_APP_UI_ITEM,
	 "Label1", 0,
	 0, 0, 0,
	 GNOME_APP_PIXMAP_STOCK, GNOME_STOCK_MENU_STOP,
	 0, 0, 0},
};

static GnomeUIInfo mainmenu[] = {
	GNOMEUIINFO_SUBTREE ("s_ub1", gnome_menu),
	GNOMEUIINFO_SUBTREE ("_sub2", sub2),
	GNOMEUIINFO_END
};

int doit (gpointer unused)
{
	if (menu)
	{
		gtk_widget_destroy (menu);
		menu = NULL;
	} else
	{
		menu = gnome_popup_menu_new (mainmenu);
		gtk_menu_popup (GTK_MENU (menu), NULL, NULL, NULL, NULL, 0, 0);
	}

	return 1;
}

int main(int argc, char **argv)
{
	gnome_init (argv[0], "0.1", argc, argv);
	gtk_timeout_add (25, doit, 0);
	gtk_main ();
	return 0;
}



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]