summaryrefslogtreecommitdiff
path: root/telepathy-glib/message-mixin.c
diff options
context:
space:
mode:
authorWill Thompson <will.thompson@collabora.co.uk>2011-10-03 13:54:57 +0100
committerWill Thompson <will.thompson@collabora.co.uk>2011-10-03 14:10:26 +0100
commit4d41eec6c0b51c8bedd2a15fafc64529e45c4340 (patch)
treebf71fe266ddaab1a6cbf21ad6ab0cb3a80b65e8f /telepathy-glib/message-mixin.c
parentc3f9dd779c1d780eab6d0de8be510c2ea45fc796 (diff)
downloadtelepathy-glib-4d41eec6c0b51c8bedd2a15fafc64529e45c4340.tar.gz
MessageMixin: don't crash if an id appears twice
Fixes: <https://bugs.freedesktop.org/show_bug.cgi?id=40523>
Diffstat (limited to 'telepathy-glib/message-mixin.c')
-rw-r--r--telepathy-glib/message-mixin.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/telepathy-glib/message-mixin.c b/telepathy-glib/message-mixin.c
index 02adc8059..e7df1792e 100644
--- a/telepathy-glib/message-mixin.c
+++ b/telepathy-glib/message-mixin.c
@@ -390,6 +390,7 @@ tp_message_mixin_acknowledge_pending_messages_async (
{
TpMessageMixin *mixin = TP_MESSAGE_MIXIN (iface);
GPtrArray *links = g_ptr_array_sized_new (ids->len);
+ TpIntset *seen = tp_intset_new ();
guint i;
for (i = 0; i < ids->len; i++)
@@ -397,6 +398,10 @@ tp_message_mixin_acknowledge_pending_messages_async (
guint id = g_array_index (ids, guint, i);
GList *link_;
+ if (tp_intset_is_member (seen, id))
+ continue;
+
+ tp_intset_add (seen, id);
link_ = g_queue_find_custom (mixin->priv->pending,
GUINT_TO_POINTER (id), pending_item_id_equals_data);
@@ -410,6 +415,7 @@ tp_message_mixin_acknowledge_pending_messages_async (
g_error_free (error);
g_ptr_array_unref (links);
+ tp_intset_destroy (seen);
return;
}
@@ -434,6 +440,7 @@ tp_message_mixin_acknowledge_pending_messages_async (
}
g_ptr_array_unref (links);
+ tp_intset_destroy (seen);
tp_svc_channel_type_text_return_from_acknowledge_pending_messages (context);
}