aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-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;