[frogr] Refactor finishing the upload of one picture and fix a leak
- From: Mario Sanchez Prada <msanchez src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [frogr] Refactor finishing the upload of one picture and fix a leak
- Date: Fri, 2 Nov 2012 08:49:28 +0000 (UTC)
commit 53d3d96261ecffeb3e7a15b90f36b3de6b95956b
Author: Mario Sanchez Prada <msanchez gnome org>
Date: Wed Oct 31 12:40:39 2012 +0100
Refactor finishing the upload of one picture and fix a leak
src/frogr-controller.c | 15 +++++++++++----
1 files changed, 11 insertions(+), 4 deletions(-)
---
diff --git a/src/frogr-controller.c b/src/frogr-controller.c
index eee0eba..dd9d845 100644
--- a/src/frogr-controller.c
+++ b/src/frogr-controller.c
@@ -162,6 +162,8 @@ static void _upload_picture (FrogrController *self, FrogrPicture *picture, Uploa
static void _upload_picture_cb (GObject *object, GAsyncResult *res, gpointer data);
+static void _finish_upload_one_picture_process (FrogrController *self, UploadOnePictureData *uop_data);
+
static void _finish_upload_pictures_process (FrogrController *self, UploadPicturesData *up_data);
static void _set_license_cb (GObject *object, GAsyncResult *res, gpointer data);
@@ -727,7 +729,7 @@ _upload_picture_cb (GObject *object, GAsyncResult *res, gpointer data)
DEBUG("Error uploading picture %s. Retrying... (attempt %d / %d)",
frogr_picture_get_title (picture), up_data->n_attempts, MAX_UPLOAD_ATTEMPTS);
- g_slice_free (UploadOnePictureData, uop_data);
+ _finish_upload_one_picture_process (controller, uop_data);
_upload_picture (controller, picture, up_data);
return;
}
@@ -794,6 +796,13 @@ _upload_picture_cb (GObject *object, GAsyncResult *res, gpointer data)
}
static void
+_finish_upload_one_picture_process (FrogrController *self, UploadOnePictureData *uop_data)
+{
+ g_object_unref (uop_data->picture);
+ g_slice_free (UploadOnePictureData, uop_data);
+}
+
+static void
_finish_upload_pictures_process (FrogrController *self, UploadPicturesData *up_data)
{
if (!up_data->error)
@@ -1243,12 +1252,10 @@ _complete_picture_upload_on_idle (gpointer data)
/* Re-check account info to make sure we have up-to-date info */
_fetch_account_extra_info (controller);
- g_object_unref (picture);
+ _finish_upload_one_picture_process (controller, uop_data);
_upload_next_picture (controller, up_data);
- g_slice_free (UploadOnePictureData, uop_data);
-
return FALSE;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]