evolution r35425 - trunk/plugins/itip-formatter



Author: sragavan
Date: Mon Apr 28 05:35:59 2008
New Revision: 35425
URL: http://svn.gnome.org/viewvc/evolution?rev=35425&view=rev

Log:
2008-04-28  Srinivasa Ragavan  <sragavan novell com>

	** Fix for BNC bug #382687

	* plugins/itip-formatter/itip-formatter.c: Don't download contents in
	main thread, which causes deadlock


Modified:
   trunk/plugins/itip-formatter/ChangeLog
   trunk/plugins/itip-formatter/itip-formatter.c

Modified: trunk/plugins/itip-formatter/itip-formatter.c
==============================================================================
--- trunk/plugins/itip-formatter/itip-formatter.c	(original)
+++ trunk/plugins/itip-formatter/itip-formatter.c	Mon Apr 28 05:35:59 2008
@@ -1351,8 +1351,6 @@
 static gboolean
 extract_itip_data (struct _itip_puri *pitip, GtkContainer *container)
 {
-	CamelDataWrapper *content;
-	CamelStream *mem;
 	icalproperty *prop;
 	icalcomponent_kind kind = ICAL_NO_COMPONENT;
 	icalcomponent *tz_comp;
@@ -1362,12 +1360,8 @@
 	ECalComponent *comp;
 	char *my_address;
 
-	content = camel_medium_get_content_object ((CamelMedium *) pitip->part);
-	mem = camel_stream_mem_new ();
-	camel_data_wrapper_decode_to_stream (content, mem);
 
-	if (((CamelStreamMem *) mem)->buffer->len == 0) {
-		camel_object_unref (mem);
+	if (!pitip->vcalendar) {
 		set_itip_error (pitip, container,
 				_("The calendar attached is not valid"),
 				_("The message claims to contain a calendar, but the calendar is not a valid iCalendar."));
@@ -1375,10 +1369,6 @@
 		return FALSE;
 	}
 
-	pitip->vcalendar = g_strndup ((char *)((CamelStreamMem *) mem)->buffer->data, ((CamelStreamMem *) mem)->buffer->len);
-
-	camel_object_unref (mem);
-
 	pitip->top_level = e_cal_util_new_top_level ();
 
 	pitip->main_comp = icalparser_parse_string (pitip->vcalendar);
@@ -2241,6 +2231,8 @@
 	GConfClient *gconf;
 	char *classid;
 	struct _itip_puri *puri;
+	CamelDataWrapper *content;
+	CamelStream *mem;
 
 	classid = g_strdup_printf("itip:///%s", ((EMFormat *) target->format)->part_id->str);
 
@@ -2257,6 +2249,18 @@
 	puri->puri.free = puri_free;
 	g_object_unref (gconf);
 
+	/* This is non-gui thread. Download the part for using in the main thread */
+	content = camel_medium_get_content_object ((CamelMedium *) target->part);
+	mem = camel_stream_mem_new ();
+	camel_data_wrapper_decode_to_stream (content, mem);
+
+	if (((CamelStreamMem *) mem)->buffer->len == 0)
+		puri->vcalendar = NULL;
+	else 
+		puri->vcalendar = g_strndup ((char *)((CamelStreamMem *) mem)->buffer->data, ((CamelStreamMem *) mem)->buffer->len);
+	camel_object_unref (mem);
+	
+
 	camel_stream_printf (target->stream, "<table border=0 width=\"100%%\" cellpadding=3><tr>");
 	camel_stream_printf (target->stream, "<td valign=top><object classid=\"%s\"></object></td><td width=100%% valign=top>", classid);
 	camel_stream_printf (target->stream, "</td></tr></table>");



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