r2615 - in trunk/src/target/OM-2007.2/applications/openmoko-dialer2: . src

njp at sita.openmoko.org njp at sita.openmoko.org
Fri Aug 3 12:57:00 CEST 2007


Author: njp
Date: 2007-08-03 12:56:59 +0200 (Fri, 03 Aug 2007)
New Revision: 2615

Modified:
   trunk/src/target/OM-2007.2/applications/openmoko-dialer2/ChangeLog
   trunk/src/target/OM-2007.2/applications/openmoko-dialer2/src/moko-contacts.c
Log:
2007-08-03  Neil J. Patel  <njp at o-hand.com>

	* src/moko-contacts.c: (moko_contacts_finalize):
	Free lists/structs properly.

Modified: trunk/src/target/OM-2007.2/applications/openmoko-dialer2/ChangeLog
===================================================================
--- trunk/src/target/OM-2007.2/applications/openmoko-dialer2/ChangeLog	2007-08-03 10:39:58 UTC (rev 2614)
+++ trunk/src/target/OM-2007.2/applications/openmoko-dialer2/ChangeLog	2007-08-03 10:56:59 UTC (rev 2615)
@@ -1,5 +1,10 @@
 2007-08-03  Neil J. Patel  <njp at o-hand.com>
 
+	* src/moko-contacts.c: (moko_contacts_finalize):
+	Free lists/structs properly.
+
+2007-08-03  Neil J. Patel  <njp at o-hand.com>
+
 	* src/moko-contacts.c: (moko_contacts_get_photo),
 	(moko_contacts_lookup), (moko_contacts_add_contact),
 	(moko_contacts_init):

Modified: trunk/src/target/OM-2007.2/applications/openmoko-dialer2/src/moko-contacts.c
===================================================================
--- trunk/src/target/OM-2007.2/applications/openmoko-dialer2/src/moko-contacts.c	2007-08-03 10:39:58 UTC (rev 2614)
+++ trunk/src/target/OM-2007.2/applications/openmoko-dialer2/src/moko-contacts.c	2007-08-03 10:56:59 UTC (rev 2615)
@@ -218,6 +218,39 @@
 static void
 moko_contacts_finalize (GObject *contacts)
 {
+  MokoContactsPrivate *priv;
+  GList *l;
+  
+  g_return_if_fail (MOKO_IS_CONTACTS (contacts));
+  priv = MOKO_CONTACTS (contacts)->priv;
+
+  g_hash_table_destroy (priv->prefixes);
+
+  for (l = priv->contacts; l != NULL; l = l->next)
+  {
+    MokoContact *contact = (MokoContact*)l->data;
+    if (contact)
+    {
+      g_free (contact->uid);
+      g_free (contact->name);
+      if (G_IS_OBJECT (contact->photo))
+        g_object_unref (contact->photo);
+    }
+  }
+  g_list_free (priv->contacts);
+  
+  for (l = priv->entries; l != NULL; l = l->next)
+  {
+    MokoContactEntry *entry = (MokoContactEntry*)l->data;
+    if (entry)
+    {
+      g_free (entry->desc);
+      g_free (entry->number);
+      entry->contact = NULL;
+    }
+  }
+  g_list_free (priv->entries);
+
   G_OBJECT_CLASS (moko_contacts_parent_class)->finalize (contacts);
 }
 





More information about the commitlog mailing list