SF.net SVN: geany-plugins:[750] trunk/geany-plugins/addons/src/ao_doclist.c

eht16 at users.sourceforge.net eht16 at xxxxx
Tue Jun 16 21:36:57 UTC 2009


Revision: 750
          http://geany-plugins.svn.sourceforge.net/geany-plugins/?rev=750&view=rev
Author:   eht16
Date:     2009-06-16 21:36:56 +0000 (Tue, 16 Jun 2009)

Log Message:
-----------
Fix a memory leak.

Modified Paths:
--------------
    trunk/geany-plugins/addons/src/ao_doclist.c

Modified: trunk/geany-plugins/addons/src/ao_doclist.c
===================================================================
--- trunk/geany-plugins/addons/src/ao_doclist.c	2009-06-16 21:34:16 UTC (rev 749)
+++ trunk/geany-plugins/addons/src/ao_doclist.c	2009-06-16 21:36:56 UTC (rev 750)
@@ -172,7 +172,7 @@
 
 static void ao_toolbar_item_doclist_clicked_cb(GtkWidget *button, gpointer data)
 {
-	GtkWidget *menu;
+	static GtkWidget *menu = NULL;
 	GtkWidget *menu_item;
 	GtkWidget *menu_item_label;
 	guint i;
@@ -181,9 +181,10 @@
 	GeanyDocument *doc;
 	GeanyDocument *current_doc = document_get_current();
 
+	if (menu != NULL)
+		gtk_widget_destroy(menu);
+
 	menu = gtk_menu_new();
-	/* FIXME we are leaking the menu here as it is never ever destroyed. We could destroy it in
-	 * its "unmap-event" handler but this seems a little hack'ish. */
 
 	for (i = 0; i < geany->documents_array->len; i++)
 	{


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.



More information about the Plugins-Commits mailing list