aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMilan Crha <mcrha@redhat.com>2010-01-28 15:13:07 +0800
committerMilan Crha <mcrha@redhat.com>2010-01-28 15:13:07 +0800
commit866a83694991787aacff34b6fe0778a50c598883 (patch)
treec716faccddb5ffd8b61e4df4cef1b6e097517666
parent3dc10be2a3905998ecc666ec140b4ccd6562bc46 (diff)
downloadgsoc2013-evolution-866a83694991787aacff34b6fe0778a50c598883.tar.gz
gsoc2013-evolution-866a83694991787aacff34b6fe0778a50c598883.tar.zst
gsoc2013-evolution-866a83694991787aacff34b6fe0778a50c598883.zip
Bug #605596 - Crash on message change
-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 {