Don't leak TpfPersona references for each Individual
authorPhilip Withnall <philip.withnall@collabora.co.uk>
Tue, 13 Jul 2010 13:46:07 +0000 (14:46 +0100)
committerPhilip Withnall <philip.withnall@collabora.co.uk>
Wed, 14 Jul 2010 09:20:01 +0000 (10:20 +0100)
Due to bgo#624249, GLib.List.remove() leaks an item reference, so we need to
manually unreference each persona we remove from the personas list in
Individual.

folks/individual.vala

index 395c7bb..26652d6 100644 (file)
@@ -320,6 +320,11 @@ public class Folks.Individual : Object,
           foreach (var persona in persona_set)
             {
               this._personas.remove (persona);
+              /* FIXME: bgo#624249 means GLib.List leaks item references.
+               * We probably eventually want to transition away from GLib.List
+               * and use Gee.LinkedList, but that would mean exposing libgee
+               * in the public API. */
+              g_object_unref (persona);
             }
         }
       if (store != null)
@@ -348,6 +353,8 @@ public class Folks.Individual : Object,
 
           persona_set.remove (p);
           this._personas.remove (p);
+          /* FIXME: bgo#624249 means GLib.List leaks item references */
+          g_object_unref (p);
         });
 
       if (this._personas.length () < 1)