Index: camel/ChangeLog
===================================================================
--- camel/ChangeLog	(revision 8349)
+++ camel/ChangeLog	(working copy)
@@ -1,3 +1,11 @@
+2008-01-11  Milan Crha  <mcrha@redhat.com>
+
+	** Fix for bug #324168
+
+	* camel-vee-summary.c: (vee_message_info_free),
+	(camel_vee_summary_add): Ensure the owner of the real message info
+	will not be freed before we unref the message info itself.
+
 2008-01-09  Milan Crha  <mcrha@redhat.com>
 
 	* Reverted previous patch because it doesn't play well with
Index: camel/camel-vee-summary.c
===================================================================
--- camel/camel-vee-summary.c	(revision 8348)
+++ camel/camel-vee-summary.c	(working copy)
@@ -40,9 +40,14 @@
 vee_message_info_free(CamelFolderSummary *s, CamelMessageInfo *info)
 {
 	CamelVeeMessageInfo *mi = (CamelVeeMessageInfo *)info;
+	CamelFolderSummary *real_summary = mi->real->summary;
 
 	g_free(info->uid);
 	camel_message_info_free(mi->real);
+
+	/* and unref the real summary too */
+	if (real_summary)
+		camel_object_unref (real_summary);
 }
 
 static CamelMessageInfo *
@@ -218,6 +223,12 @@
 	mi = (CamelVeeMessageInfo *)camel_message_info_new(&s->summary);
 	mi->real = info;
 	camel_message_info_ref(info);
+
+	/* Ensures the owner of the message info will not die before we free the mi->real;
+	   It's obvious that the real->summary should not be changed after this call. */
+	if (info->summary)
+		camel_object_ref (info->summary);
+
 	mi->info.uid = vuid;
 
 	camel_folder_summary_add(&s->summary, (CamelMessageInfo *)mi);
