Revision: 2279 http://geany-plugins.svn.sourceforge.net/geany-plugins/?rev=2279&view=re... Author: colombanw Date: 2011-10-14 00:38:54 +0000 (Fri, 14 Oct 2011) Log Message: ----------- Addons: plug a few memory leaks
Modified Paths: -------------- trunk/geany-plugins/addons/src/addons.c trunk/geany-plugins/addons/src/ao_systray.c trunk/geany-plugins/addons/src/ao_tasks.c
Modified: trunk/geany-plugins/addons/src/addons.c =================================================================== --- trunk/geany-plugins/addons/src/addons.c 2011-10-14 00:38:32 UTC (rev 2278) +++ trunk/geany-plugins/addons/src/addons.c 2011-10-14 00:38:54 UTC (rev 2279) @@ -294,6 +294,8 @@ 0, 0, "update_tasks", _("Update Tasks List"), NULL); keybindings_set_item(key_group, KB_XMLTAGGING, kb_ao_xmltagging, 0, 0, "xml_tagging", _("Run XML tagging"), NULL); + + g_key_file_free(config); }
Modified: trunk/geany-plugins/addons/src/ao_systray.c =================================================================== --- trunk/geany-plugins/addons/src/ao_systray.c 2011-10-14 00:38:32 UTC (rev 2278) +++ trunk/geany-plugins/addons/src/ao_systray.c 2011-10-14 00:38:54 UTC (rev 2279) @@ -72,7 +72,7 @@ AoSystrayPrivate *priv = AO_SYSTRAY_GET_PRIVATE(object);
g_object_unref(priv->icon); - gtk_widget_destroy(priv->popup_menu); + g_object_unref(priv->popup_menu); #endif
G_OBJECT_CLASS(ao_systray_parent_class)->finalize(object); @@ -197,6 +197,7 @@ #endif
priv->popup_menu = gtk_menu_new(); + g_object_ref_sink(priv->popup_menu);
item = gtk_image_menu_item_new_from_stock(GTK_STOCK_OPEN, NULL); gtk_widget_show(item);
Modified: trunk/geany-plugins/addons/src/ao_tasks.c =================================================================== --- trunk/geany-plugins/addons/src/ao_tasks.c 2011-10-14 00:38:32 UTC (rev 2278) +++ trunk/geany-plugins/addons/src/ao_tasks.c 2011-10-14 00:38:54 UTC (rev 2279) @@ -294,7 +294,7 @@ } if (priv->popup_menu) { - gtk_widget_destroy(priv->popup_menu); + g_object_unref(priv->popup_menu); priv->popup_menu = NULL; } } @@ -478,6 +478,7 @@ gtk_label_new(_("Tasks")));
priv->popup_menu = create_popup_menu(t); + g_object_ref_sink(priv->popup_menu); }
@@ -508,22 +509,23 @@
if (gtk_tree_model_get_iter_first(model, &iter)) { - while (TRUE) + gboolean has_next; + + do { gtk_tree_model_get(model, &iter, TLIST_COL_FILENAME, &filename, -1);
if (utils_str_equal(filename, cur_doc->file_name)) { /* gtk_list_store_remove() manages the iter and set it to the next row */ - if (! gtk_list_store_remove(priv->store, &iter)) - break; + has_next = gtk_list_store_remove(priv->store, &iter); } else { /* if we didn't delete the row, we need to manage the iter manually */ - if (! gtk_tree_model_iter_next(model, &iter)) - break; + has_next = gtk_tree_model_iter_next(model, &iter); } g_free(filename); } + while (has_next); } }
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.