[gthumb] fixed a crash when loading remote images



commit 638fa7dfcf605505dc1ebe593c9f661e0e1b4bf9
Author: Paolo Bacchilega <paobac src gnome org>
Date:   Sat Sep 10 18:27:32 2011 +0200

    fixed a crash when loading remote images

 gthumb/gth-image-loader.c |    2 +-
 gthumb/gth-image.c        |    3 +++
 gthumb/pixbuf-io.c        |   10 +++++++++-
 3 files changed, 13 insertions(+), 2 deletions(-)
---
diff --git a/gthumb/gth-image-loader.c b/gthumb/gth-image-loader.c
index b316250..4edf983 100644
--- a/gthumb/gth-image-loader.c
+++ b/gthumb/gth-image-loader.c
@@ -421,7 +421,7 @@ gth_image_loader_load_finish (GthImageLoader   *loader,
 
 	  load_result = g_simple_async_result_get_op_res_gpointer (simple);
 	  if (image != NULL)
-		  *image = g_object_ref (load_result->image);
+		  *image = _g_object_ref (load_result->image);
 	  if (original_width != NULL)
 	  	  *original_width = load_result->original_width;
 	  if (original_height != NULL)
diff --git a/gthumb/gth-image.c b/gthumb/gth-image.c
index 85b5968..cfe4467 100644
--- a/gthumb/gth-image.c
+++ b/gthumb/gth-image.c
@@ -211,6 +211,9 @@ gth_image_get_pixbuf (GthImage *image)
 {
 	GdkPixbuf *result = NULL;
 
+	if (image == NULL)
+		return NULL;
+
 	switch (image->priv->format) {
 	case GTH_IMAGE_FORMAT_CAIRO_SURFACE:
 		result = _gdk_pixbuf_new_from_cairo_surface (image->priv->data.surface);
diff --git a/gthumb/pixbuf-io.c b/gthumb/pixbuf-io.c
index 961d7fb..f6534f3 100644
--- a/gthumb/pixbuf-io.c
+++ b/gthumb/pixbuf-io.c
@@ -357,10 +357,18 @@ gth_pixbuf_new_from_file (GthFileData   *file_data,
 	if (original_height != NULL)
 		*original_height = -1;
 
-	if (file_data == NULL)
+	if (file_data == NULL) {
+		if (error != NULL)
+			*error = g_error_new_literal (G_IO_ERROR, G_IO_ERROR_INVALID_FILENAME, "Could not load file");
 		return NULL;
+	}
 
 	path = g_file_get_path (file_data->file);
+	if (path == NULL) {
+		if (error != NULL)
+			*error = g_error_new_literal (G_IO_ERROR, G_IO_ERROR_INVALID_FILENAME, "Could not load file");
+		return NULL;
+	}
 
 	scale_pixbuf = FALSE;
 	original_w = -1;



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