Blob Blame History Raw
From d64150ab966cfd9d661aa06999573fe42fe2671e Mon Sep 17 00:00:00 2001
From: Milan Crha <mcrha@redhat.com>
Date: Fri, 17 Jan 2014 15:24:42 +0000
Subject: Bug #702958 - Crash on attachment add or remove

---
diff --git a/e-util/e-attachment.c b/e-util/e-attachment.c
index ea4f39c..8230eab 100644
--- a/e-util/e-attachment.c
+++ b/e-util/e-attachment.c
@@ -334,6 +334,9 @@ attachment_update_icon_column_idle_cb (gpointer weak_ref)
 
 	if (file_info != NULL) {
 		icon = g_file_info_get_icon (file_info);
+		/* add the reference here, thus the create_system_thumbnail() can unref the *icon. */
+		if (icon)
+			g_object_ref (icon);
 		thumbnail_path = g_file_info_get_attribute_byte_string (
 			file_info, G_FILE_ATTRIBUTE_THUMBNAIL_PATH);
 	}
@@ -351,11 +354,11 @@ attachment_update_icon_column_idle_cb (gpointer weak_ref)
 		/* Nothing to do, just use the icon. */
 
 	/* Else use the standard icon for the content type. */
-	} else if (icon != NULL)
-		g_object_ref (icon);
+	} else if (icon != NULL) {
+		/* Nothing to do, just use the already reffed icon. */
 
 	/* Last ditch fallback.  (GFileInfo not yet loaded?) */
-	else
+	} else
 		icon = g_themed_icon_new (DEFAULT_ICON_NAME);
 
 	/* Pick an emblem, limit one.  Choices listed by priority. */
--
cgit v0.9.2