aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNot Zed <NotZed@Ximian.com>2004-12-01 11:41:29 +0800
committerMichael Zucci <zucchi@src.gnome.org>2004-12-01 11:41:29 +0800
commit7f793b912853b340fd2e3d12c26d0452f55227c5 (patch)
tree9afd20a609ea3a4536aa24315f20eaf2264376a6
parentbba69b99980a3f3386c98ccc98b4136ca5860d92 (diff)
downloadgsoc2013-evolution-7f793b912853b340fd2e3d12c26d0452f55227c5.tar
gsoc2013-evolution-7f793b912853b340fd2e3d12c26d0452f55227c5.tar.gz
gsoc2013-evolution-7f793b912853b340fd2e3d12c26d0452f55227c5.tar.bz2
gsoc2013-evolution-7f793b912853b340fd2e3d12c26d0452f55227c5.tar.lz
gsoc2013-evolution-7f793b912853b340fd2e3d12c26d0452f55227c5.tar.xz
gsoc2013-evolution-7f793b912853b340fd2e3d12c26d0452f55227c5.tar.zst
gsoc2013-evolution-7f793b912853b340fd2e3d12c26d0452f55227c5.zip
** See bug #69339.
2004-11-22 Not Zed <NotZed@Ximian.com> ** See bug #69339. * em-format-html.c (efh_format_do): after closing the base output stream, re-loop if more jobs were queued. 2004-11-19 Not Zed <NotZed@Ximian.com> ** See bug #69339. * em-format-html.c (efh_format_do): close the stream/html after we're finished, since the multipart/related stuff may write more content for orphaned attachments. svn path=/trunk/; revision=28024
-rw-r--r--mail/ChangeLog15
-rw-r--r--mail/em-format-html.c72
2 files changed, 57 insertions, 30 deletions
diff --git a/mail/ChangeLog b/mail/ChangeLog
index 1ca8830418..23fc490568 100644
--- a/mail/ChangeLog
+++ b/mail/ChangeLog
@@ -1,3 +1,18 @@
+2004-11-22 Not Zed <NotZed@Ximian.com>
+
+ ** See bug #69339.
+
+ * em-format-html.c (efh_format_do): after closing the base output
+ stream, re-loop if more jobs were queued.
+
+2004-11-19 Not Zed <NotZed@Ximian.com>
+
+ ** See bug #69339.
+
+ * em-format-html.c (efh_format_do): close the stream/html after we're
+ finished, since the multipart/related stuff may write more content
+ for orphaned attachments.
+
2004-11-23 Not Zed <NotZed@Ximian.com>
** See bug #69579.
diff --git a/mail/em-format-html.c b/mail/em-format-html.c
index 6925e785e5..1ede7873b7 100644
--- a/mail/em-format-html.c
+++ b/mail/em-format-html.c
@@ -69,7 +69,7 @@
#include "em-html-stream.h"
#include "em-utils.h"
-#define d(x)
+#define d(x)
#define EFH_TABLE_OPEN "<table>"
@@ -1165,43 +1165,55 @@ static void efh_format_do(struct _mail_msg *mm)
em_format_format_message((EMFormat *)m->format, (CamelStream *)m->estream, (CamelMedium *)m->message);
}
- camel_stream_write_string((CamelStream *)m->estream, "</body>\n</html>\n");
- camel_stream_close((CamelStream *)m->estream);
- camel_object_unref(m->estream);
- m->estream = NULL;
+ camel_stream_flush((CamelStream *)m->estream);
puri_level = ((EMFormat *)m->format)->pending_uri_level;
base = ((EMFormat *)m->format)->base;
- /* now dispatch any added tasks ... */
- g_mutex_lock(m->format->priv->lock);
- while ((job = (struct _EMFormatHTMLJob *)e_dlist_remhead(&m->format->priv->pending_jobs))) {
+ do {
+ /* now dispatch any added tasks ... */
+ g_mutex_lock(m->format->priv->lock);
+ while ((job = (struct _EMFormatHTMLJob *)e_dlist_remhead(&m->format->priv->pending_jobs))) {
+ g_mutex_unlock(m->format->priv->lock);
+
+ /* This is an implicit check to see if the gtkhtml has been destroyed */
+ if (!cancelled)
+ cancelled = m->format->html == NULL;
+
+ /* Now do an explicit check for user cancellation */
+ if (!cancelled)
+ cancelled = camel_operation_cancel_check(NULL);
+
+ /* call jobs even if cancelled, so they can clean up resources */
+ ((EMFormat *)m->format)->pending_uri_level = job->puri_level;
+ if (job->base)
+ ((EMFormat *)m->format)->base = job->base;
+ job->callback(job, cancelled);
+ ((EMFormat *)m->format)->base = base;
+
+ /* clean up the job */
+ camel_object_unref(job->stream);
+ if (job->base)
+ camel_url_free(job->base);
+ g_free(job);
+
+ g_mutex_lock(m->format->priv->lock);
+ }
g_mutex_unlock(m->format->priv->lock);
- /* This is an implicit check to see if the gtkhtml has been destroyed */
- if (!cancelled)
- cancelled = m->format->html == NULL;
-
- /* Now do an explicit check for user cancellation */
- if (!cancelled)
- cancelled = camel_operation_cancel_check(NULL);
-
- /* call jobs even if cancelled, so they can clean up resources */
- ((EMFormat *)m->format)->pending_uri_level = job->puri_level;
- if (job->base)
- ((EMFormat *)m->format)->base = job->base;
- job->callback(job, cancelled);
- ((EMFormat *)m->format)->base = base;
+ if (m->estream) {
+ /* Closing this base stream can queue more jobs, so we need
+ to check the list again after we've finished */
+ d(printf("out of jobs, closing root stream\n"));
+ camel_stream_write_string((CamelStream *)m->estream, "</body>\n</html>\n");
+ camel_stream_close((CamelStream *)m->estream);
+ camel_object_unref(m->estream);
+ m->estream = NULL;
+ }
- /* clean up the job */
- camel_object_unref(job->stream);
- if (job->base)
- camel_url_free(job->base);
- g_free(job);
+ /* e_dlist_empty is atomic and doesn't need locking */
+ } while (!e_dlist_empty(&m->format->priv->pending_jobs));
- g_mutex_lock(m->format->priv->lock);
- }
- g_mutex_unlock(m->format->priv->lock);
d(printf("out of jobs, done\n"));
((EMFormat *)m->format)->pending_uri_level = puri_level;