From fcfa0973c74c9d03020b6ea8c42a0362ccff791e Mon Sep 17 00:00:00 2001 From: Simon McVittie Date: Tue, 1 Oct 2013 17:08:00 +0100 Subject: TpContact: avoid a race condition in avatar handling We have to remember the avatar token synchronously, before we start async-saving the cached file, so that we can't get into this situation: my avatar is token "A", bytes "AAAA..." my avatar changes to token "B", bytes "BBBB..." we start saving the file /.../B my avatar changes to token "C", bytes "CCCC..." saving the file /.../B finishes change-notification announces that my avatar has changed to "B" which is particularly problematic for Mission Control. Regression in 0.21.2 (fd.o #63402). Bug: https://bugs.freedesktop.org/show_bug.cgi?id=70010 Reviewed-by: Guillaume Desmottes --- telepathy-glib/contact.c | 36 +++++++++++++++++++++++++++++++----- 1 file changed, 31 insertions(+), 5 deletions(-) diff --git a/telepathy-glib/contact.c b/telepathy-glib/contact.c index abf38efec..4a77f1137 100644 --- a/telepathy-glib/contact.c +++ b/telepathy-glib/contact.c @@ -40,6 +40,15 @@ #include "telepathy-glib/util-internal.h" #include "telepathy-glib/variant-util-internal.h" +static const gchar * +nonnull (const gchar *s) +{ + if (s == NULL) + return "(null)"; + + return s; +} + /** * SECTION:contact * @title: TpContact @@ -2805,18 +2814,28 @@ mime_file_written (GObject *source_object, self = g_weak_ref_get (&avatar_data->contact); - if (self != NULL) + if (self == NULL) + { + DEBUG ("No relevant TpContact"); + } + else if (tp_strdiff (avatar_data->token, self->priv->avatar_token)) { + DEBUG ("Contact's avatar token has changed from %s to %s, " + "this avatar is no longer relevant", + avatar_data->token, nonnull (self->priv->avatar_token)); + } + else + { + DEBUG ("Saved avatar '%s' of MIME type '%s' still used by '%s' to '%s'", + avatar_data->token, avatar_data->mime_type, + self->priv->identifier, + g_file_get_path (avatar_data->file)); g_clear_object (&self->priv->avatar_file); self->priv->avatar_file = g_object_ref (avatar_data->file); g_free (self->priv->avatar_mime_type); self->priv->avatar_mime_type = g_strdup (avatar_data->mime_type); - /* Update the avatar token if a newer one is given - * (this emits notify::avatar-token if needed) */ - contact_set_avatar_token (self, avatar_data->token, FALSE); - /* Notify both property changes together once both files have been * written */ g_object_notify ((GObject *) self, "avatar-mime-type"); @@ -2872,6 +2891,13 @@ contact_avatar_retrieved (TpConnection *connection, gchar *mime_filename; WriteAvatarData *avatar_data; + if (self != NULL) + { + /* Update the avatar token if a newer one is given + * (this emits notify::avatar-token if needed) */ + contact_set_avatar_token (self, token, FALSE); + } + if (!build_avatar_filename (connection, token, TRUE, &filename, &mime_filename)) return; -- cgit v1.2.3 From ab5cef9789cb51cccd44aacbed80494a9379831e Mon Sep 17 00:00:00 2001 From: Simon McVittie Date: Wed, 2 Oct 2013 14:31:44 +0100 Subject: 0.22.0 --- NEWS | 26 ++++++++++++++++++++++++-- configure.ac | 8 ++++---- 2 files changed, 28 insertions(+), 6 deletions(-) diff --git a/NEWS b/NEWS index 803d2a354..6151af18f 100644 --- a/NEWS +++ b/NEWS @@ -1,11 +1,33 @@ -telepathy-glib 0.21.3 (UNRELEASED) +telepathy-glib 0.22.0 (2013-10-02) ================================== -Fixes: +The “don't starve” release. + +This is a new stable branch, recommended for use with GNOME 3.10. + +Fixes since 0.21.2: + +• When an avatar is downloaded, announce the change to the avatar token + immediately; if the avatar changes from A to B while we're still doing the + asynchronous file saving, don't set A as the new avatar when it has been + saved. Regression in 0.21.2. (fd.o #70010, Simon) • Don't crash if the AccountManager returns an incorrect type for the Avatar (fd.o #69849, Simon) +Significant changes since the previous stable branch, 0.20.x: + +• tp_connection_get_self_contact() now returns NULL if the contact's + connection has been invalidated, in order to break a reference cycle + +• Avatars are saved to the cache asynchronously + +• TpBaseConnection implements SelfID, SelfContactChanged according to + telepathy-spec 0.27.2 + +• TpAccount:uri-schemes property, with change notification requiring + Mission Control 5.15+ + telepathy-glib 0.21.2 (2013-09-24) ================================== diff --git a/configure.ac b/configure.ac index d66c8b048..227e30c1e 100644 --- a/configure.ac +++ b/configure.ac @@ -10,9 +10,9 @@ AC_PREREQ([2.60]) # set nano_version to 1 m4_define([tp_glib_major_version], [0]) -m4_define([tp_glib_minor_version], [21]) -m4_define([tp_glib_micro_version], [2]) -m4_define([tp_glib_nano_version], [1]) +m4_define([tp_glib_minor_version], [22]) +m4_define([tp_glib_micro_version], [0]) +m4_define([tp_glib_nano_version], [0]) # If library source has changed since last release, increment revision # If interfaces have been added, removed or changed since last release, @@ -27,7 +27,7 @@ m4_define([tp_glib_nano_version], [1]) # never seen in a release). m4_define([tp_glib_lt_current], [80]) -m4_define([tp_glib_lt_revision], [0]) +m4_define([tp_glib_lt_revision], [1]) m4_define([tp_glib_lt_age], [80]) # Some magic -- cgit v1.2.3 From 96cfbd0e8401ab06b729cfa5b092d5939899dc6b Mon Sep 17 00:00:00 2001 From: Simon McVittie Date: Wed, 2 Oct 2013 15:02:31 +0100 Subject: nano version --- NEWS | 5 +++++ configure.ac | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/NEWS b/NEWS index 6151af18f..07663fa1b 100644 --- a/NEWS +++ b/NEWS @@ -1,3 +1,8 @@ +telepathy-glib 0.22.1 (UNRELEASED) +================================== + +… + telepathy-glib 0.22.0 (2013-10-02) ================================== diff --git a/configure.ac b/configure.ac index 227e30c1e..f46732eeb 100644 --- a/configure.ac +++ b/configure.ac @@ -12,7 +12,7 @@ AC_PREREQ([2.60]) m4_define([tp_glib_major_version], [0]) m4_define([tp_glib_minor_version], [22]) m4_define([tp_glib_micro_version], [0]) -m4_define([tp_glib_nano_version], [0]) +m4_define([tp_glib_nano_version], [1]) # If library source has changed since last release, increment revision # If interfaces have been added, removed or changed since last release, -- cgit v1.2.3