[gthumb] cairo-io: fixed crash when resizing a series of images



commit d2f1258cade8e7637dccdae1a1933e6b9489e204
Author: Paolo Bacchilega <paobac src gnome org>
Date:   Sat Aug 18 23:55:40 2012 +0200

    cairo-io: fixed crash when resizing a series of images

 extensions/resize_images/dlg-resize-images.c |    4 ++--
 gthumb/pixbuf-io.c                           |   10 ++--------
 2 files changed, 4 insertions(+), 10 deletions(-)
---
diff --git a/extensions/resize_images/dlg-resize-images.c b/extensions/resize_images/dlg-resize-images.c
index 9885493..d8f05f6 100644
--- a/extensions/resize_images/dlg-resize-images.c
+++ b/extensions/resize_images/dlg-resize-images.c
@@ -134,8 +134,8 @@ exec_resize (GthAsyncTask *task,
 	gth_image_task_set_destination (GTH_IMAGE_TASK (task), destination_image);
 
 	_g_object_unref (destination_image);
-	_g_object_unref (destination);
-	_g_object_unref (source);
+	cairo_surface_destroy (destination);
+	cairo_surface_destroy (source);
 
 	return NULL;
 }
diff --git a/gthumb/pixbuf-io.c b/gthumb/pixbuf-io.c
index 719b669..313e0f0 100644
--- a/gthumb/pixbuf-io.c
+++ b/gthumb/pixbuf-io.c
@@ -323,11 +323,11 @@ gth_pixbuf_animation_new_from_file (GInputStream  *istream,
 	char               *path;
 	GthImage           *image;
 
-	mime_type = gth_file_data_get_mime_type (file_data);
+	mime_type = _g_content_type_get_from_stream (istream, cancellable, error);
 	if (mime_type == NULL)
 		return NULL;
 
-	if (! g_content_type_equals (mime_type, "image/gif"))
+	if ((file_data == NULL) || ! g_content_type_equals (mime_type, "image/gif"))
 		return gth_pixbuf_new_from_file (istream,
 						 file_data,
 						 requested_size,
@@ -337,12 +337,6 @@ gth_pixbuf_animation_new_from_file (GInputStream  *istream,
 						 cancellable,
 						 error);
 
-	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)



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