diff options
author | Jonny Lamb <jonny.lamb@collabora.co.uk> | 2011-03-22 15:02:32 +0000 |
---|---|---|
committer | Jonny Lamb <jonny.lamb@collabora.co.uk> | 2011-03-22 15:04:02 +0000 |
commit | 018286b9c3f881fe35f2facfb5f52264dd99e231 (patch) | |
tree | 2fde9f401fe7281740d6854280c2788f28c75a7c | |
parent | 5dd3fcd91d00332f126d447bdc76cecfd0b355ce (diff) |
meta-porter: fix tallying up calls to the close_async function
PorterData* can have a NULL porter, which means the meta-porter
doesn't need to close it. However, previously, the close_all_porters
function didn't care about that and treated as that a remaining
porter anyway.
Signed-off-by: Jonny Lamb <jonny.lamb@collabora.co.uk>
-rw-r--r-- | wocky/wocky-meta-porter.c | 17 |
1 files changed, 8 insertions, 9 deletions
diff --git a/wocky/wocky-meta-porter.c b/wocky/wocky-meta-porter.c index 5246b22..19f166e 100644 --- a/wocky/wocky-meta-porter.c +++ b/wocky/wocky-meta-porter.c @@ -1282,21 +1282,19 @@ close_all_porters (WockyMetaPorter *self, WockyMetaPorterPrivate *priv = self->priv; GSimpleAsyncResult *simple; GList *porters, *l; - guint num; porters = g_hash_table_get_values (priv->porters); - num = g_list_length (porters); simple = g_simple_async_result_new (G_OBJECT (self), callback, user_data, source_tag); g_signal_emit_by_name (self, "closing"); - if (num > 0) + if (porters != NULL) { ClosePorterData *data = g_slice_new0 (ClosePorterData); data->close_finish = close_finish_func; - data->remaining = num; + data->remaining = 0; data->simple = simple; for (l = porters; l != NULL; l = l->next) @@ -1307,19 +1305,20 @@ close_all_porters (WockyMetaPorter *self, if (porter_data->porter == NULL) continue; + data->remaining++; + close_async_func (porter_data->porter, cancellable, porter_close_cb, data); } } - - g_list_free (porters); - - /* there were no porters to close anyway */ - if (num == 0) + else { + /* there were no porters to close anyway */ g_simple_async_result_complete (simple); g_object_unref (simple); } + + g_list_free (porters); } static void |