diff options
author | Travis Reitter <treitter@gmail.com> | 2010-07-15 04:55:07 +0800 |
---|---|---|
committer | Travis Reitter <treitter@gmail.com> | 2010-07-22 00:03:37 +0800 |
commit | da5ec3c2bf5f816cff03932d23aec183beb18ee5 (patch) | |
tree | 1b9946b44dc4e085d3c8afd06b0d75d9c29ee64f /libempathy-gtk | |
parent | 5ee7ffd39ff228c35d0fb85aa7d55bbfe044e73f (diff) | |
download | gsoc2013-empathy-da5ec3c2bf5f816cff03932d23aec183beb18ee5.tar gsoc2013-empathy-da5ec3c2bf5f816cff03932d23aec183beb18ee5.tar.gz gsoc2013-empathy-da5ec3c2bf5f816cff03932d23aec183beb18ee5.tar.bz2 gsoc2013-empathy-da5ec3c2bf5f816cff03932d23aec183beb18ee5.tar.lz gsoc2013-empathy-da5ec3c2bf5f816cff03932d23aec183beb18ee5.tar.xz gsoc2013-empathy-da5ec3c2bf5f816cff03932d23aec183beb18ee5.tar.zst gsoc2013-empathy-da5ec3c2bf5f816cff03932d23aec183beb18ee5.zip |
Merge remote branch 'pwith/folks-integ-rebase1-fixes-rebase1' into folks-fixes
Diffstat (limited to 'libempathy-gtk')
-rw-r--r-- | libempathy-gtk/empathy-contact-widget.c | 4 | ||||
-rw-r--r-- | libempathy-gtk/empathy-individual-menu.c | 6 | ||||
-rw-r--r-- | libempathy-gtk/empathy-individual-store.c | 27 |
3 files changed, 23 insertions, 14 deletions
diff --git a/libempathy-gtk/empathy-contact-widget.c b/libempathy-gtk/empathy-contact-widget.c index 92f6c4b58..9bdad5534 100644 --- a/libempathy-gtk/empathy-contact-widget.c +++ b/libempathy-gtk/empathy-contact-widget.c @@ -1460,9 +1460,9 @@ contact_widget_remove_contact (EmpathyContactWidget *information) if (information->details_cancellable != NULL) { + /* The cancellable will be unreffed and cleared in + * contact_widget_details_request_cb */ g_cancellable_cancel (information->details_cancellable); - g_object_unref (information->details_cancellable); - information->details_cancellable = NULL; } } diff --git a/libempathy-gtk/empathy-individual-menu.c b/libempathy-gtk/empathy-individual-menu.c index fcac824b7..72ea1b80b 100644 --- a/libempathy-gtk/empathy-individual-menu.c +++ b/libempathy-gtk/empathy-individual-menu.c @@ -143,7 +143,6 @@ empathy_individual_menu_new (FolksIndividual *individual, gtk_widget_show (item); } -#if HAVE_FAVOURITE_CONTACTS /* Favorite checkbox */ if (features & EMPATHY_INDIVIDUAL_FEATURE_FAVOURITE) { @@ -151,7 +150,6 @@ empathy_individual_menu_new (FolksIndividual *individual, gtk_menu_shell_append (shell, item); gtk_widget_show (item); } -#endif return menu; } @@ -175,7 +173,7 @@ empathy_individual_add_menu_item_new (FolksIndividual *individual) { GtkWidget *item; GtkWidget *image; - EmpathyIndividualManager *manager; + EmpathyIndividualManager *manager = NULL; EmpathyContact *contact = NULL; TpConnection *connection; GList *l, *members; @@ -215,7 +213,6 @@ empathy_individual_add_menu_item_new (FolksIndividual *individual) } } g_list_free (members); - g_object_unref (manager); if (found) { @@ -233,6 +230,7 @@ empathy_individual_add_menu_item_new (FolksIndividual *individual) out: tp_clear_object (&contact); + tp_clear_object (&manager); return item; } diff --git a/libempathy-gtk/empathy-individual-store.c b/libempathy-gtk/empathy-individual-store.c index da590608a..623e35626 100644 --- a/libempathy-gtk/empathy-individual-store.c +++ b/libempathy-gtk/empathy-individual-store.c @@ -345,7 +345,6 @@ individual_store_add_individual (EmpathyIndividualStore *self, GtkTreeIter iter; GHashTable *group_set = NULL; GList *groups = NULL, *l; - EmpathyIndividualManager *manager; EmpathyContact *contact; TpConnection *connection; EmpathyIndividualManagerFlags flags = 0; @@ -363,10 +362,9 @@ individual_store_add_individual (EmpathyIndividualStore *self, groups = g_hash_table_get_keys (group_set); } - manager = empathy_individual_manager_dup_singleton (); contact = empathy_contact_dup_from_folks_individual (individual); connection = empathy_contact_get_connection (contact); - flags = empathy_individual_manager_get_flags_for_connection (manager, + flags = empathy_individual_manager_get_flags_for_connection (priv->manager, connection); tp_connection_parse_object_path (connection, &protocol_name, NULL); @@ -481,8 +479,15 @@ individual_store_contact_active_new (EmpathyIndividualStore *self, data = g_slice_new0 (ShowActiveData); - data->self = g_object_ref (self); - data->individual = g_object_ref (individual); + /* We don't actually want to force either the IndividualStore or the + * Individual to stay alive, since the user could quit Empathy or disable + * the account before the contact_active timeout is fired. */ + g_object_add_weak_pointer (G_OBJECT (self), (gpointer) &(data->self)); + g_object_add_weak_pointer (G_OBJECT (individual), + (gpointer) &(data->individual)); + + data->self = self; + data->individual = individual; data->remove = remove_; return data; @@ -491,9 +496,6 @@ individual_store_contact_active_new (EmpathyIndividualStore *self, static void individual_store_contact_active_free (ShowActiveData *data) { - g_object_unref (data->individual); - g_object_unref (data->self); - g_slice_free (ShowActiveData, data); } @@ -502,6 +504,15 @@ individual_store_contact_active_cb (ShowActiveData *data) { EmpathyIndividualStorePriv *priv; + /* They're weak pointers, so may have been NULLified between ShowActiveData + * being created and the timeout being fired. We assume they can only be + * destroyed in this thread, so this isn't MT-safe. */ + if (data->self == NULL || data->individual == NULL) + { + individual_store_contact_active_free (data); + return FALSE; + } + priv = GET_PRIV (data->self); if (data->remove && |