Merge lp://staging/~rodrigo-moya/libubuntuone/progress-downloads-only into lp://staging/libubuntuone

Proposed by Rodrigo Moya
Status: Merged
Approved by: Rodrigo Moya
Approved revision: 59
Merged at revision: not available
Proposed branch: lp://staging/~rodrigo-moya/libubuntuone/progress-downloads-only
Merge into: lp://staging/libubuntuone
Diff against target: 69 lines (+34/-4)
1 file modified
libubuntuone/u1-music-store.c (+34/-4)
To merge this branch: bzr merge lp://staging/~rodrigo-moya/libubuntuone/progress-downloads-only
Reviewer Review Type Date Requested Status
Stuart Langridge (community) Approve
dobey (community) Needs Fixing
Review via email: mp+20757@code.staging.launchpad.net

Commit message

Notify downloads finished correctly

Description of the change

Notify downloads finished correctly

To post a comment you must log in.
57. By Rodrigo Moya

Merge from trunk

58. By Rodrigo Moya

Merge from trunk

Revision history for this message
dobey (dobey) wrote :

You should probably g_slist_free (keys) when you're done using it, no?

30 + for (keys = g_hash_table_get_keys (current_downloads);
31 + keys != NULL; ) {
32 + g_hash_table_insert (downloads_in_progress, g_strdup (keys->data), g_strdup (keys->data));
33 + keys = g_slist_remove (keys, keys->data);
34 + }

Also, does this for loop work correctly? _get_keys does return a GList and not a GSList, so I suspect that may also cause problems. The documentation also states you shouldn't free the items in the list, as they're owned by the hash table still, and you should only g_list_free() when done using the list returned.

I prefer the keys = _get_keys(); for (l = keys; l != NULL && l->data != NULL; l = l->next) syntax for looping through G[S]Lists though.

review: Needs Fixing
59. By Rodrigo Moya

Use GList, not GSListvim /opt/extra/src/glib/glib/ghash.h

Revision history for this message
Stuart Langridge (sil) wrote :

Works!

review: Approve
Revision history for this message
Rodrigo Moya (rodrigo-moya) wrote :

> You should probably g_slist_free (keys) when you're done using it, no?
>
> 30 + for (keys = g_hash_table_get_keys (current_downloads);
> 31 + keys != NULL; ) {
> 32 + g_hash_table_insert (downloads_in_progress, g_strdup (keys->data),
> g_strdup (keys->data));
> 33 + keys = g_slist_remove (keys, keys->data);
> 34 + }
>
> Also, does this for loop work correctly? _get_keys does return a GList and not
> a GSList, so I suspect that may also cause problems. The documentation also
> states you shouldn't free the items in the list, as they're owned by the hash
> table still, and you should only g_list_free() when done using the list
> returned.
>
this is already fixed. g_list_remove returns NULL when there are no more items on the list, so there's nothing to g_list_free

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
The diff is not available at this time. You can reload the page or download it.

Subscribers

People subscribed via source and target branches