aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--mail/em-html-stream.c2
-rw-r--r--mail/em-sync-stream.c7
-rw-r--r--mail/em-sync-stream.h1
3 files changed, 6 insertions, 4 deletions
diff --git a/mail/em-html-stream.c b/mail/em-html-stream.c
index cc3c795d32..0e0119a7ba 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 982a56c90a..e7c4770247 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 3d74a02a35..3823e82f9c 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 {