diff options
-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 | ||||
-rw-r--r-- | libempathy/empathy-individual-manager.c | 1 | ||||
-rw-r--r-- | po/POTFILES.in | 1 | ||||
-rw-r--r-- | src/empathy-main-window.c | 2 |
6 files changed, 27 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 && diff --git a/libempathy/empathy-individual-manager.c b/libempathy/empathy-individual-manager.c index 61f61f96d..218dddaa6 100644 --- a/libempathy/empathy-individual-manager.c +++ b/libempathy/empathy-individual-manager.c @@ -284,6 +284,7 @@ aggregator_add_persona_from_details_cb (GObject *source, /* We can unref the contact now */ g_object_unref (contact); + g_object_unref (persona); } void diff --git a/po/POTFILES.in b/po/POTFILES.in index a89aff235..21a67d6c9 100644 --- a/po/POTFILES.in +++ b/po/POTFILES.in @@ -66,6 +66,7 @@ src/empathy-account-assistant.c src/empathy-accounts-dialog.c [type: gettext/glade]src/empathy-accounts-dialog.ui src/empathy-auto-salut-account-helper.c +src/empathy-av.c src/empathy-call-window.c [type: gettext/glade]src/empathy-call-window.ui src/empathy-chat-window.c diff --git a/src/empathy-main-window.c b/src/empathy-main-window.c index be3ca5498..ae50eaa4e 100644 --- a/src/empathy-main-window.c +++ b/src/empathy-main-window.c @@ -1623,6 +1623,8 @@ empathy_main_window_init (EmpathyMainWindow *window) individual_manager = empathy_individual_manager_dup_singleton (); priv->individual_store = empathy_individual_store_new ( individual_manager); + g_object_unref (individual_manager); + priv->individual_view = empathy_individual_view_new ( priv->individual_store, EMPATHY_INDIVIDUAL_VIEW_FEATURE_ALL, |