diff options
author | Guillaume Desmottes <guillaume.desmottes@collabora.co.uk> | 2011-12-12 17:48:06 +0100 |
---|---|---|
committer | Guillaume Desmottes <guillaume.desmottes@collabora.co.uk> | 2011-12-13 09:45:48 +0100 |
commit | 78c39c68e7722673e1737cbaaeb44f8357524968 (patch) | |
tree | 5ea1b0ba5b34bf1e7aa07b0b71395d3913676198 | |
parent | 788e6a69c8414b64052c65ceb834430ffca11e56 (diff) | |
download | telepathy-glib-78c39c68e7722673e1737cbaaeb44f8357524968.tar.gz |
handle_owners_changed_prepared_cb: use a NULL safe g_object_ref
An unknown owner is implemented storing a NULL TpContact in the hash table.
https://bugs.freedesktop.org/show_bug.cgi?id=43755
-rw-r--r-- | telepathy-glib/channel-contacts.c | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/telepathy-glib/channel-contacts.c b/telepathy-glib/channel-contacts.c index 2146cf381..3e5fdd6c9 100644 --- a/telepathy-glib/channel-contacts.c +++ b/telepathy-glib/channel-contacts.c @@ -119,6 +119,15 @@ safe_g_object_unref (gpointer data) g_object_unref (data); } +static gpointer +safe_g_object_ref (gpointer data) +{ + if (data == NULL) + return NULL; + + return g_object_ref (data); +} + static GHashTable * dup_owners_table (TpChannel *self, GHashTable *source, @@ -712,7 +721,7 @@ handle_owners_changed_prepared_cb (GObject *object, } tp_g_hash_table_update (self->priv->group_contact_owners, data->added, NULL, - g_object_ref); + safe_g_object_ref); handle_owners_changed_data_free (data); } |