[empathy] Avoid potential segfaults if there are no contacts on the first pass.



commit 6bf4569e50d1df275281b790adcae934b8a53ce7
Author: Travis Reitter <treitter gmail com>
Date:   Tue Jun 22 08:43:53 2010 -0700

    Avoid potential segfaults if there are no contacts on the first pass.

 configure.ac                              |   25 -------------------------
 libempathy-gtk/empathy-individual-menu.c  |   23 +++++------------------
 libempathy-gtk/empathy-individual-store.c |   13 ++++++++-----
 3 files changed, 13 insertions(+), 48 deletions(-)
---
diff --git a/configure.ac b/configure.ac
index dc849eb..17e0f57 100644
--- a/configure.ac
+++ b/configure.ac
@@ -141,31 +141,6 @@ AS_COMPILER_FLAG(-Wmissing-declarations, ERROR_CFLAGS="$ERROR_CFLAGS -Wmissing-d
 AC_SUBST(ERROR_CFLAGS)
 
 # -----------------------------------------------------------
-# Enable TPL
-# -----------------------------------------------------------
-
-# It needs to be defined before PKG_CHECK_MODULES calls
-AC_ARG_ENABLE(tpl,
-  AC_HELP_STRING([--enable-tpl],[enable telepathy-logger code and disable the
-    empathy logger]), enable_tpl=$enableval, enable_tpl=no )
-AM_CONDITIONAL(ENABLE_TPL, test "x$enable_tpl" = "xyes")
-
-if test x${enable_tpl} = xyes; then
-  AC_DEFINE(ENABLE_TPL, [], [Enable TPL code])
-fi
-
-if test "x$enable_tpl" = "xyes"; then
-  PKG_CHECK_MODULES(TPL,
-  [
-     telepathy-logger = $TELEPATHY_LOGGER
-  ])
-  AC_SUBST(TPL_CFLAGS)
-  AC_SUBST(TPL_LIBS)
-fi
-
-
-
-# -----------------------------------------------------------
 # Pkg-Config dependency checks
 # -----------------------------------------------------------
 
diff --git a/libempathy-gtk/empathy-individual-menu.c b/libempathy-gtk/empathy-individual-menu.c
index a849e7e..98afbc5 100644
--- a/libempathy-gtk/empathy-individual-menu.c
+++ b/libempathy-gtk/empathy-individual-menu.c
@@ -27,12 +27,8 @@
 #include <glib/gi18n-lib.h>
 #include <gtk/gtk.h>
 #include <telepathy-glib/util.h>
-#ifdef ENABLE_TPL
 #include <telepathy-logger/log-manager.h>
-#else
 
-#include <libempathy/empathy-log-manager.h>
-#endif /* ENABLE_TPL */
 #include <libempathy/empathy-call-factory.h>
 #include <libempathy/empathy-dispatcher.h>
 #include <libempathy/empathy-contact-manager.h>
@@ -296,7 +292,8 @@ empathy_individual_audio_call_menu_item_activated (GtkMenuItem *item,
   g_return_if_fail (EMPATHY_IS_CONTACT (contact));
 
   factory = empathy_call_factory_get ();
-  empathy_call_factory_new_call_with_streams (factory, contact, TRUE, FALSE);
+  empathy_call_factory_new_call_with_streams (contact, TRUE, FALSE,
+      gtk_get_current_event_time (), NULL, NULL);
   g_object_unref (contact);
 }
 
@@ -340,7 +337,8 @@ empathy_individual_video_call_menu_item_activated (GtkMenuItem *item,
   g_return_if_fail (EMPATHY_IS_CONTACT (contact));
 
   factory = empathy_call_factory_get ();
-  empathy_call_factory_new_call_with_streams (factory, contact, TRUE, TRUE);
+  empathy_call_factory_new_call_with_streams (contact, TRUE, TRUE,
+      gtk_get_current_event_time (), NULL, NULL);
   g_object_unref (contact);
 }
 
@@ -389,11 +387,7 @@ individual_log_menu_item_activate_cb (FolksIndividual *individual)
 GtkWidget *
 empathy_individual_log_menu_item_new (FolksIndividual *individual)
 {
-#ifndef ENABLE_TPL
-  EmpathyLogManager *manager;
-#else
   TplLogManager *manager;
-#endif /* ENABLE_TPL */
   gboolean have_log;
   GtkWidget *item;
   GtkWidget *image;
@@ -405,17 +399,10 @@ empathy_individual_log_menu_item_new (FolksIndividual *individual)
 
   g_return_val_if_fail (EMPATHY_IS_CONTACT (contact), NULL);
 
-#ifndef ENABLE_TPL
-  manager = empathy_log_manager_dup_singleton ();
-  have_log = empathy_log_manager_exists (manager,
-      empathy_contact_get_account (contact), empathy_contact_get_id (contact),
-      FALSE);
-#else
   manager = tpl_log_manager_dup_singleton ();
   have_log = tpl_log_manager_exists (manager,
       empathy_contact_get_account (contact), empathy_contact_get_id (contact),
       FALSE);
-#endif /* ENABLE_TPL */
   g_object_unref (manager);
 
   item = gtk_image_menu_item_new_with_mnemonic (_("_Previous Conversations"));
@@ -505,7 +492,7 @@ empathy_individual_share_my_desktop_menu_item_new (FolksIndividual *individual)
   item = gtk_image_menu_item_new_with_mnemonic (_("Share My Desktop"));
   image = gtk_image_new_from_icon_name (GTK_STOCK_NETWORK, GTK_ICON_SIZE_MENU);
   gtk_widget_set_sensitive (item,
-      empathy_contact_can_use_stream_tube (contact));
+      empathy_contact_can_use_rfb_stream_tube (contact));
   gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (item), image);
   gtk_widget_show (image);
 
diff --git a/libempathy-gtk/empathy-individual-store.c b/libempathy-gtk/empathy-individual-store.c
index 3390f31..1931106 100644
--- a/libempathy-gtk/empathy-individual-store.c
+++ b/libempathy-gtk/empathy-individual-store.c
@@ -820,7 +820,7 @@ individual_store_manager_setup (gpointer user_data)
 {
   EmpathyIndividualStore *self = user_data;
   EmpathyIndividualStorePriv *priv = GET_PRIV (self);
-  GList *contacts;
+  GList *individuals;
 
   /* Signal connection. */
 
@@ -839,10 +839,13 @@ individual_store_manager_setup (gpointer user_data)
       G_CALLBACK (individual_store_groups_changed_cb), self);
 
   /* Add contacts already created. */
-  contacts = empathy_individual_manager_get_members (priv->manager);
-  individual_store_members_changed_cb (priv->manager, "initial add",
-      contacts, NULL, 0, self);
-  g_list_free (contacts);
+  individuals = empathy_individual_manager_get_members (priv->manager);
+  if (individuals != NULL && FOLKS_IS_INDIVIDUAL (individuals->data))
+    {
+      individual_store_members_changed_cb (priv->manager, "initial add",
+          individuals, NULL, 0, self);
+      g_list_free (individuals);
+    }
 
   priv->setup_idle_id = 0;
   return FALSE;



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]