[libgdata] demos: Fix error handling for photo uploads in the scrapbook



commit 620c9f25e26b9036e4ea27e158828c4ed8a80768
Author: Philip Withnall <philip tecnocode co uk>
Date:   Sat Jul 30 20:33:01 2011 +0100

    demos: Fix error handling for photo uploads in the scrapbook

 demos/scrapbook/scrapbook.c |    9 +++++++--
 1 files changed, 7 insertions(+), 2 deletions(-)
---
diff --git a/demos/scrapbook/scrapbook.c b/demos/scrapbook/scrapbook.c
index 2319478..e9635e7 100644
--- a/demos/scrapbook/scrapbook.c
+++ b/demos/scrapbook/scrapbook.c
@@ -519,11 +519,16 @@ select_file (ScrapPUpload *self, GtkFileChooser *file_chooser)
 
 	g_object_unref (file_info);
 	g_object_unref (self->file);
+	self->file = NULL;
 
 	if (error != NULL) {
-		g_print ("error: %s\n", error->message);
+		g_print ("Error: %s\n", error->message);
+		g_error_free (error);
+
+		g_object_unref (file);
+
+		return;
 	}
-	g_free (error);
 
 	file_stream = g_file_read (file, NULL, NULL);
 	g_object_unref (file);



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]