[evolution] Bug #605596 - Crash on message change



commit 866a83694991787aacff34b6fe0778a50c598883
Author: Milan Crha <mcrha redhat com>
Date:   Thu Jan 28 08:13:07 2010 +0100

    Bug #605596 - Crash on message change

 mail/em-html-stream.c |    2 +-
 mail/em-sync-stream.c |    7 ++++---
 mail/em-sync-stream.h |    1 +
 3 files changed, 6 insertions(+), 4 deletions(-)
---
diff --git a/mail/em-html-stream.c b/mail/em-html-stream.c
index cc3c795..0e0119a 100644
--- a/mail/em-html-stream.c
+++ b/mail/em-html-stream.c
@@ -124,7 +124,7 @@ static void
 em_html_stream_finalize (EMHTMLStream *emhs)
 {
 	if (emhs->html_stream) {
-		/* set 'in finalise' flag */
+		emhs->sync.in_finalize = TRUE;
 		camel_stream_close (CAMEL_STREAM (emhs));
 	}
 }
diff --git a/mail/em-sync-stream.c b/mail/em-sync-stream.c
index 982a56c..e7c4770 100644
--- a/mail/em-sync-stream.c
+++ b/mail/em-sync-stream.c
@@ -127,7 +127,7 @@ emss_stream_write (CamelStream *stream, const gchar *string, gsize len)
 	if (emss->cancel)
 		return -1;
 
-	if (mail_in_main_thread ()) {
+	if (emss->in_finalize || mail_in_main_thread ()) {
 		EMSS_CLASS (emss)->sync_write (stream, string, len);
 	} else if (emss->buffer != NULL) {
 		if (len < (emss->buffer->allocated_len - emss->buffer->len))
@@ -149,7 +149,7 @@ emss_stream_flush (CamelStream *stream)
 	if (emss->cancel)
 		return -1;
 
-	if (mail_in_main_thread ())
+	if (emss->in_finalize || mail_in_main_thread ())
 		return EMSS_CLASS (emss)->sync_flush (stream);
 	else
 		emss_sync_op (emss, EMSS_FLUSH, NULL, 0);
@@ -167,7 +167,7 @@ emss_stream_close (CamelStream *stream)
 
 	emss->idle_id = 0;
 
-	if (mail_in_main_thread ())
+	if (emss->in_finalize || mail_in_main_thread ())
 		return EMSS_CLASS (emss)->sync_close (stream);
 	else
 		emss_sync_op (emss, EMSS_CLOSE, NULL, 0);
@@ -190,6 +190,7 @@ em_sync_stream_class_init (EMSyncStreamClass *class)
 static void
 em_sync_stream_finalize (EMSyncStream *emss)
 {
+	emss->in_finalize = TRUE;
 	if (emss->buffer != NULL)
 		g_string_free (emss->buffer, TRUE);
 	if (emss->idle_id)
diff --git a/mail/em-sync-stream.h b/mail/em-sync-stream.h
index 3d74a02..3823e82 100644
--- a/mail/em-sync-stream.h
+++ b/mail/em-sync-stream.h
@@ -54,6 +54,7 @@ struct _EMSyncStream {
 	GString *buffer;
 	gboolean cancel;
 	guint idle_id;
+	gboolean in_finalize;
 };
 
 struct _EMSyncStreamClass {



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