[evolution-patches] Re: [Evolution-hackers] broken threading in mail-display



Hope this fixes it.

-Srini
On Thu, 2005-07-28 at 16:53 +0800, Not Zed wrote:
> Srini,
> 
> Your attachment patch has busted the threading in the mail display.  The
> UI can now lock for extended periods because it is doing camel
> operations from the main thread.
> 
> This particular bit of code is at least one place where it is - and to
> be honest, i'm completely baffled by it.  You're copying a whole part
> into memory just to copy the part.  Thats what references are for.
> 
> Of course, I never got a chance to review this code since you just
> committed it anyway, which was completely inappropriate to start with.
> 
> Fix it.
> 
> 
> EAttachment *
> e_attachment_new_from_mime_part (CamelMimePart *part)
> {
> 	EAttachment *new;
> 	CamelMimePart *mime_part;
> 	CamelStream *stream;
> 	
> 	g_return_val_if_fail (CAMEL_IS_MIME_PART (part), NULL);
> 	
> 	stream = camel_stream_mem_new ();
> 	if (camel_data_wrapper_write_to_stream (CAMEL_DATA_WRAPPER (part),
> stream) == -1) {
> 		camel_object_unref (stream);
> 		return NULL;
> 	}
> 	
> 	camel_stream_reset (stream);
> 	mime_part = camel_mime_part_new ();
> 	
> 	if (camel_data_wrapper_construct_from_stream (CAMEL_DATA_WRAPPER
> (mime_part), stream) == -1) {
> 		camel_object_unref (mime_part);
> 		camel_object_unref (stream);
> 		return NULL;
> 	}
> 	
> 	camel_object_unref (stream);
> 
> _______________________________________________
> evolution-hackers maillist  -  evolution-hackers lists ximian com
> http://lists.ximian.com/mailman/listinfo/evolution-hackers
Index: e-attachment.c
===================================================================
RCS file: /cvs/gnome/evolution/widgets/misc/e-attachment.c,v
retrieving revision 1.2
diff -u -p -r1.2 e-attachment.c
--- e-attachment.c	20 Jul 2005 11:17:42 -0000	1.2
+++ e-attachment.c	28 Jul 2005 09:48:48 -0000
@@ -505,31 +505,13 @@ EAttachment *
 e_attachment_new_from_mime_part (CamelMimePart *part)
 {
 	EAttachment *new;
-	CamelMimePart *mime_part;
-	CamelStream *stream;
 	
 	g_return_val_if_fail (CAMEL_IS_MIME_PART (part), NULL);
 	
-	stream = camel_stream_mem_new ();
-	if (camel_data_wrapper_write_to_stream (CAMEL_DATA_WRAPPER (part), stream) == -1) {
-		camel_object_unref (stream);
-		return NULL;
-	}
-	
-	camel_stream_reset (stream);
-	mime_part = camel_mime_part_new ();
-	
-	if (camel_data_wrapper_construct_from_stream (CAMEL_DATA_WRAPPER (mime_part), stream) == -1) {
-		camel_object_unref (mime_part);
-		camel_object_unref (stream);
-		return NULL;
-	}
-	
-	camel_object_unref (stream);
-	
 	new = g_object_new (E_TYPE_ATTACHMENT, NULL);
 	new->editor_gui = NULL;
-	new->body = mime_part;
+	camel_object_ref (part);
+	new->body = part;
 	new->guessed_type = FALSE;
 	new->is_available_local = TRUE;
 	new->size = 0;


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