[telepathy-mission-control/master] _mcd_dispatcher_enter_state_machine: make memory allocation more obviously correct
Simon McVittie
simon.mcvittie at collabora.co.uk
Mon Nov 2 06:41:35 PST 2009
Previously, we were borrowing a list that had been given to the
McdDispatchOperation, relying on the fact that it hadn't altered the list
yet.
---
src/mcd-dispatcher.c | 10 +++++-----
1 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/src/mcd-dispatcher.c b/src/mcd-dispatcher.c
index a61834e..7798e2e 100644
--- a/src/mcd-dispatcher.c
+++ b/src/mcd-dispatcher.c
@@ -1377,8 +1377,9 @@ _mcd_dispatcher_enter_state_machine (McdDispatcher *dispatcher,
* bundle? */
context->operation = _mcd_dispatch_operation_new (priv->clients,
- !requested, channels, (const gchar * const *) possible_handlers);
- /* ownership of @channels is stolen, but the GObject references are not */
+ !requested, g_list_copy (channels),
+ (const gchar * const *) possible_handlers);
+ /* the copy of @channels is stolen, but the GObject references are not */
if (!requested)
{
@@ -1394,9 +1395,6 @@ _mcd_dispatcher_enter_state_machine (McdDispatcher *dispatcher,
G_CALLBACK (on_operation_finished), context);
}
- /* FIXME: we've just donated @channels to the McdDispatchOperation, so
- * this relies on the fact that it hasn't had a chance to free anything
- * yet */
for (list = channels; list != NULL; list = list->next)
{
channel = MCD_CHANNEL (list->data);
@@ -1406,6 +1404,8 @@ _mcd_dispatcher_enter_state_machine (McdDispatcher *dispatcher,
context);
}
+ g_list_free (channels);
+
DEBUG ("entering state machine for context %p", context);
sp_timestamp ("invoke internal filters");
--
1.5.6.5
More information about the telepathy-commits
mailing list