Summary: | Add tp_message_set_message() method | ||
---|---|---|---|
Product: | Telepathy | Reporter: | Danielle Madeley <danielle> |
Component: | tp-glib | Assignee: | Telepathy bugs list <telepathy-bugs> |
Status: | RESOLVED FIXED | QA Contact: | Telepathy bugs list <telepathy-bugs> |
Severity: | normal | ||
Priority: | medium | Keywords: | patch |
Version: | git master | ||
Hardware: | Other | ||
OS: | All | ||
URL: | http://cgit.collabora.com/git/user/danni/telepathy-glib.git/log/?h=set_message-38061 | ||
Whiteboard: | |||
i915 platform: | i915 features: |
Description
Danielle Madeley
2011-06-07 20:38:33 UTC
> Compliments tp_cm_message_take_message().
“Have you been working out, tp_cm_message_take_message()? You look great!”
+ g_return_if_fail (self != message);
Nice attention to detail. :)
+ g_hash_table_insert (g_ptr_array_index (self->parts, part),
+ g_strdup (key),
+ tp_g_value_slice_new_boxed (TP_ARRAY_TYPE_MESSAGE_PART_LIST,
+ message->parts));
I *believe* that this will not copy the message parts, just ref 'em. In other words, if you modify @message after calling tp_cm_message_set_message(), it will also modify the copy in @self.
We need to document this one way or another.
We could just say that this is the case: but I bet it will trip people up. There have been bugs in Wocky due to repeatedly passing the same WockyStanza * to wocky_porter_send_async(), changing (say) its recipient each time, and accidentally sending n copies of the stanza to the last recipient.
Or we could explicitly copy @message. (It could be that this is actually already what happens, in which case, ideal!)
I leave the decision in your capable hands.
(In reply to comment #2) > I *believe* that this will not copy the message parts, just ref 'em. In other > words, if you modify @message after calling tp_cm_message_set_message(), it > will also modify the copy in @self. You're right, in recent GLib g_boxed_copy() will frequently take refs instead of copying. I think we want to take a copy, so you can throw away the message at your leisure (or change it, as you say). Updated. Now with tests! Merged to master. Miaow, says Escher! |
Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.