From 14f7ef8252a1933ad1ccea4418178fe088c4cd34 Mon Sep 17 00:00:00 2001 From: Guillaume Desmottes Date: Mon, 12 Dec 2011 17:48:06 +0100 Subject: [PATCH] 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 --- 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 2146cf3..3e5fdd6 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); } -- 1.7.7.4