]> git.0d.be Git - empathy.git/blobdiff - libempathy-gtk/empathy-individual-store.c
Merge branch 'sasl'
[empathy.git] / libempathy-gtk / empathy-individual-store.c
index abd1d02e855361263609645ba8d7c2e8556198f0..4b07131a60ac1691ce63cf3398ab01e08b306a7b 100644 (file)
@@ -164,7 +164,13 @@ individual_get_client_types (FolksIndividual *individual)
   personas = folks_individual_get_personas (individual);
   for (l = personas; l != NULL; l = l->next)
     {
-      FolksPresence *presence = FOLKS_PRESENCE (l->data);
+      FolksPresence *presence;
+
+      /* We only want personas which implement FolksPresence */
+      if (!FOLKS_IS_PRESENCE (l->data))
+        continue;
+
+      presence = FOLKS_PRESENCE (l->data);
 
       if (folks_presence_typecmp (folks_presence_get_presence_type (presence),
               presence_type) > 0)
@@ -355,6 +361,13 @@ individual_store_find_contact (EmpathyIndividualStore *self,
   return l;
 }
 
+static void
+free_iters (GList *iters)
+{
+  g_list_foreach (iters, (GFunc) gtk_tree_iter_free, NULL);
+  g_list_free (iters);
+}
+
 static void
 individual_store_remove_individual (EmpathyIndividualStore *self,
     FolksIndividual *individual)
@@ -391,8 +404,7 @@ individual_store_remove_individual (EmpathyIndividualStore *self,
         }
     }
 
-  g_list_foreach (iters, (GFunc) gtk_tree_iter_free, NULL);
-  g_list_free (iters);
+  free_iters (iters);
 }
 
 static void
@@ -514,9 +526,7 @@ individual_store_contact_set_active (EmpathyIndividualStore *self,
         }
     }
 
-  g_list_foreach (iters, (GFunc) gtk_tree_iter_free, NULL);
-  g_list_free (iters);
-
+  free_iters (iters);
 }
 
 static void individual_store_contact_active_free (ShowActiveData *data);
@@ -641,6 +651,8 @@ individual_avatar_pixbuf_received_cb (FolksIndividual *individual,
               EMPATHY_INDIVIDUAL_STORE_COL_PIXBUF_AVATAR, pixbuf,
               -1);
         }
+
+      free_iters (iters);
     }
 
   /* Free things */
@@ -654,6 +666,7 @@ individual_avatar_pixbuf_received_cb (FolksIndividual *individual,
           data->cancellable);
     }
 
+  tp_clear_object (&pixbuf);
   g_object_unref (data->cancellable);
   g_slice_free (LoadAvatarData, data);
 }
@@ -815,8 +828,7 @@ individual_store_contact_update (EmpathyIndividualStore *self,
    * timeout removes the user from the contact list, really we
    * should remove the first timeout.
    */
-  g_list_foreach (iters, (GFunc) gtk_tree_iter_free, NULL);
-  g_list_free (iters);
+  free_iters (iters);
 }
 
 static void
@@ -1507,6 +1519,8 @@ individual_store_name_sort_func (GtkTreeModel *model,
 
   tp_clear_object (&individual_a);
   tp_clear_object (&individual_b);
+  g_free (name_a);
+  g_free (name_b);
 
   return ret_val;
 }