[gnome-documents/wip/facebook] facebook miner: Manager albums list in a better way, freeing memory at the end.
- From: Álvaro Peña <alvaropg src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-documents/wip/facebook] facebook miner: Manager albums list in a better way, freeing memory at the end.
- Date: Wed, 5 Jun 2013 15:21:46 +0000 (UTC)
commit 6ca139db1cb1df401d0e39a4b3e5dbc4d0ef2ae3
Author: Álvaro Peña <alvaropg gmail com>
Date: Wed Jun 5 17:09:37 2013 +0200
facebook miner: Manager albums list in a better way, freeing memory at the end.
src/miner/gd-facebook-miner.c | 22 ++++++++++++++++------
1 files changed, 16 insertions(+), 6 deletions(-)
---
diff --git a/src/miner/gd-facebook-miner.c b/src/miner/gd-facebook-miner.c
index 4140220..55c8d29 100644
--- a/src/miner/gd-facebook-miner.c
+++ b/src/miner/gd-facebook-miner.c
@@ -88,6 +88,8 @@ query_facebook (GdAccountMinerJob *job, GError **error)
GFBGraphUser *me;
gchar *me_name;
GList *albums = NULL;
+ GList *album_iter = NULL;
+ GError *tmp_error = NULL;
me = gfbgraph_user_get_me (GFBGRAPH_AUTHORIZER (job->service), error);
if (*error != NULL) {
@@ -97,24 +99,32 @@ query_facebook (GdAccountMinerJob *job, GError **error)
g_object_get (me, "name", &me_name, NULL);
- albums = gfbgraph_user_get_albums (me, GFBGRAPH_AUTHORIZER (job->service), error);
- if (*error != NULL) {
- g_warning ("Error getting albums");
+ albums = gfbgraph_user_get_albums (me, GFBGRAPH_AUTHORIZER (job->service), &tmp_error);
+ if (tmp_error != NULL) {
+ g_warning ("Error getting albums. Error (%d): %s", tmp_error->code, tmp_error->message);
goto out;
}
- while (albums) {
+ album_iter = albums;
+ while (album_iter) {
GFBGraphAlbum *album;
- album = albums->data;
+ album = GFBGRAPH_ALBUM (album_iter->data);
account_miner_job_lookup_album (job, album, (const gchar*) me_name, error);
- albums = g_list_next (albums);
+ album_iter = g_list_next (album_iter);
}
out:
+ if (tmp_error != NULL)
+ g_propagate_error (error, tmp_error);
+
+ if (albums != NULL)
+ g_list_free_full (albums, g_object_unref);
+
if (me_name)
g_free (me_name);
+
g_clear_object (&me);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]