summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWill Thompson <will.thompson@collabora.co.uk>2011-10-04 15:41:18 +0100
committerWill Thompson <will.thompson@collabora.co.uk>2011-10-04 15:41:18 +0100
commitf1b611ea1a5e06cd801d059db05dd00de6ad5e1c (patch)
treed61b0a7ee51dcf29702fee16f815837225125252
parentbe940765ac3e355ee7efb52a49bf68431e52b0c0 (diff)
parent41be1c9d7467a643efc6c12cf3b96816d98fbd30 (diff)
Merge branch 'telepathy-glib-0.14'
Conflicts: NEWS configure.ac telepathy-glib/message-mixin.c
-rw-r--r--NEWS17
-rw-r--r--telepathy-glib/message-mixin.c39
-rw-r--r--tests/dbus/message-mixin.c8
3 files changed, 52 insertions, 12 deletions
diff --git a/NEWS b/NEWS
index cc7ade395..ee8664ab6 100644
--- a/NEWS
+++ b/NEWS
@@ -1,3 +1,20 @@
+telepathy-glib 0.15.7 (UNRELEASED)
+==================================
+
+Fixes:
+
+• fd.o#40555: Memory leaks in TpConnection and protocol.c (Vivek)
+
+• Memory leak if the debug message cache is disabled (Vivek)
+
+• fd.o#38060: Fix a crash in TpMessageMixin, triggered by delivery
+ reports. (Danni)
+
+• fd.o#38997: Cope beter if UNIX sockets are not supported. (Guillaume)
+
+• fd.o#40523: Connection Manager crash when a client acks the same
+ message twice. (Will)
+
telepathy-glib 0.15.6 (2011-09-30)
==================================
diff --git a/telepathy-glib/message-mixin.c b/telepathy-glib/message-mixin.c
index facc24580..eb47fa1f2 100644
--- a/telepathy-glib/message-mixin.c
+++ b/telepathy-glib/message-mixin.c
@@ -55,6 +55,7 @@
#include <telepathy-glib/message-mixin.h>
#include <dbus/dbus-glib.h>
+#include <dbus/dbus-glib-lowlevel.h>
#include <string.h>
#include <telepathy-glib/cm-message.h>
@@ -389,19 +390,30 @@ tp_message_mixin_acknowledge_pending_messages_async (
DBusGMethodInvocation *context)
{
TpMessageMixin *mixin = TP_MESSAGE_MIXIN (iface);
- GList **nodes;
+ GPtrArray *links = g_ptr_array_sized_new (ids->len);
+ TpIntset *seen = tp_intset_new ();
guint i;
- nodes = g_new (GList *, ids->len);
-
for (i = 0; i < ids->len; i++)
{
guint id = g_array_index (ids, guint, i);
+ GList *link_;
+
+ if (tp_intset_is_member (seen, id))
+ {
+ gchar *client = dbus_g_method_get_sender (context);
- nodes[i] = g_queue_find_custom (mixin->priv->pending,
+ DEBUG ("%s passed message id %u more than once in one call to "
+ "AcknowledgePendingMessages. Foolish pup.", client, id);
+ g_free (client);
+ continue;
+ }
+
+ tp_intset_add (seen, id);
+ link_ = g_queue_find_custom (mixin->priv->pending,
GUINT_TO_POINTER (id), pending_item_id_equals_data);
- if (nodes[i] == NULL)
+ if (link_ == NULL)
{
GError *error = g_error_new (TP_ERRORS, TP_ERROR_INVALID_ARGUMENT,
"invalid message id %u", id);
@@ -410,26 +422,31 @@ tp_message_mixin_acknowledge_pending_messages_async (
dbus_g_method_return_error (context, error);
g_error_free (error);
- g_free (nodes);
+ g_ptr_array_unref (links);
+ tp_intset_destroy (seen);
return;
}
+
+ g_ptr_array_add (links, link_);
}
tp_svc_channel_interface_messages_emit_pending_messages_removed (iface,
ids);
- for (i = 0; i < ids->len; i++)
+ for (i = 0; i < links->len; i++)
{
- TpMessage *item = nodes[i]->data;
- TpCMMessage *cm_msg = nodes[i]->data;
+ GList *link_ = g_ptr_array_index (links, i);
+ TpMessage *item = link_->data;
+ TpCMMessage *cm_msg = link_->data;
DEBUG ("acknowledging message id %u", cm_msg->incoming_id);
- g_queue_remove (mixin->priv->pending, item);
+ g_queue_delete_link (mixin->priv->pending, link_);
tp_message_destroy (item);
}
- g_free (nodes);
+ g_ptr_array_unref (links);
+ tp_intset_destroy (seen);
tp_svc_channel_type_text_return_from_acknowledge_pending_messages (context);
}
diff --git a/tests/dbus/message-mixin.c b/tests/dbus/message-mixin.c
index 938981f46..2d499c316 100644
--- a/tests/dbus/message-mixin.c
+++ b/tests/dbus/message-mixin.c
@@ -1043,9 +1043,15 @@ main (int argc,
g_print ("\n\n==== Acknowledging one message ====\n");
{
- GArray *msgid = g_array_sized_new (FALSE, FALSE, sizeof (guint), 1);
+ /* As a regression test for
+ * <https://bugs.freedesktop.org/show_bug.cgi?id=40523>, we include the
+ * ID of the message we want to ack twice. This used to cause a
+ * double-free.
+ */
+ GArray *msgid = g_array_sized_new (FALSE, FALSE, sizeof (guint), 2);
g_array_append_val (msgid, last_received_id);
+ g_array_append_val (msgid, last_received_id);
tp_cli_channel_type_text_run_acknowledge_pending_messages (chan, -1,
msgid, &error, NULL);