changeset 1247:09da3f14490d

fixed possible crash
author nadvornik
date Fri, 23 Jan 2009 22:53:02 +0000
parents 854435704554
children f3cb10d0ad0d
files src/image.c
diffstat 1 files changed, 6 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/src/image.c	Wed Jan 21 18:30:54 2009 +0000
+++ b/src/image.c	Fri Jan 23 22:53:02 2009 +0000
@@ -1003,6 +1003,10 @@
 	gint read_exif_for_color_profile = (imd->color_profile_enable && imd->color_profile_use_image);
 	gint read_exif_for_orientation = FALSE;
 
+	/* read_exif and similar functions can actually notice that the file has changed and triger a notification
+	that removes the pixbuf	from cache and unref it. Therefore we must ref it here before it is taken over by the renderer. */
+	g_object_ref(pixbuf); 
+	
 	if (imd->image_fd && imd->image_fd->user_orientation)
 		imd->orientation = imd->image_fd->user_orientation;
 	else if (options->image.exif_rotate_enable)
@@ -1041,6 +1045,8 @@
 		pixbuf_renderer_set_orientation((PixbufRenderer *)imd->pr, imd->orientation);
 		}
 
+	g_object_unref(pixbuf);
+
 	if (imd->color_profile_enable)
 		{
 		if (!image_post_process_color(imd, 0, exif, FALSE))