From 87307d86390edb84adbe686073c00a8294ecb827 Mon Sep 17 00:00:00 2001 From: Srinivasa Ragavan Date: Mon, 28 Apr 2008 05:35:59 +0000 Subject: ** Fix for BNC bug #382687 2008-04-28 Srinivasa Ragavan ** Fix for BNC bug #382687 * plugins/itip-formatter/itip-formatter.c: Don't download contents in main thread, which causes deadlock svn path=/trunk/; revision=35425 --- plugins/itip-formatter/ChangeLog | 7 +++++++ plugins/itip-formatter/itip-formatter.c | 26 +++++++++++++++----------- 2 files changed, 22 insertions(+), 11 deletions(-) (limited to 'plugins/itip-formatter') diff --git a/plugins/itip-formatter/ChangeLog b/plugins/itip-formatter/ChangeLog index ab9127e883..7972237286 100644 --- a/plugins/itip-formatter/ChangeLog +++ b/plugins/itip-formatter/ChangeLog @@ -1,3 +1,10 @@ +2008-04-28 Srinivasa Ragavan + + ** Fix for BNC bug #382687 + + * plugins/itip-formatter/itip-formatter.c: Don't download contents in + main thread, which causes deadlock + 2008-03-27 Milan Crha ** Fix for bug #523541 diff --git a/plugins/itip-formatter/itip-formatter.c b/plugins/itip-formatter/itip-formatter.c index cd7199920b..9369efaf59 100644 --- a/plugins/itip-formatter/itip-formatter.c +++ b/plugins/itip-formatter/itip-formatter.c @@ -1351,8 +1351,6 @@ set_itip_error (struct _itip_puri *pitip, GtkContainer *container, const char *p 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 @@ extract_itip_data (struct _itip_puri *pitip, GtkContainer *container) 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 @@ extract_itip_data (struct _itip_puri *pitip, GtkContainer *container) 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 @@ format_itip (EPlugin *ep, EMFormatHookTarget *target) 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 @@ format_itip (EPlugin *ep, EMFormatHookTarget *target) 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, ""); camel_stream_printf (target->stream, "
", classid); camel_stream_printf (target->stream, "
"); -- cgit v1.2.3