[evolution-patches] 69339 again, multipart/related workarounds
- From: Not Zed <notzed ximian com>
- To: asdf <evolution-patches lists ximian com>
- Subject: [evolution-patches] 69339 again, multipart/related workarounds
- Date: Mon, 22 Nov 2004 11:08:39 +0800
This should fix the code properely, I rememberd this morning that closing the html stream might finish extra processing which wasn't otherwise done until that point, causing more jobs to be created.
Index: mail/ChangeLog
===================================================================
RCS file: /cvs/gnome/evolution/mail/ChangeLog,v
retrieving revision 1.3444.2.26
diff -u -p -r1.3444.2.26 ChangeLog
--- mail/ChangeLog 19 Nov 2004 00:45:55 -0000 1.3444.2.26
+++ mail/ChangeLog 22 Nov 2004 03:20:16 -0000
@@ -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-10 Not Zed <NotZed Ximian com>
** See bug #68794.
Index: mail/em-format-html.c
===================================================================
RCS file: /cvs/gnome/evolution/mail/em-format-html.c,v
retrieving revision 1.63.4.3
diff -u -p -r1.63.4.3 em-format-html.c
--- mail/em-format-html.c 3 Nov 2004 02:29:56 -0000 1.63.4.3
+++ mail/em-format-html.c 22 Nov 2004 03:20:17 -0000
@@ -71,7 +71,7 @@
#include "em-html-stream.h"
#include "em-utils.h"
-#define d(x)
+#define d(x)
#define EFH_TABLE_OPEN "<table>"
@@ -1184,43 +1184,55 @@ static void efh_format_do(struct _mail_m
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;
-
- /* clean up the job */
- camel_object_unref(job->stream);
- if (job->base)
- camel_url_free(job->base);
- g_free(job);
+ 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;
+ }
+
+ /* 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;
Index: mail/em-format.c
===================================================================
RCS file: /cvs/gnome/evolution/mail/em-format.c,v
retrieving revision 1.38.8.3
diff -u -p -r1.38.8.3 em-format.c
--- mail/em-format.c 3 Nov 2004 02:29:56 -0000 1.38.8.3
+++ mail/em-format.c 22 Nov 2004 03:20:17 -0000
@@ -539,7 +539,7 @@ em_format_part_as(EMFormat *emf, CamelSt
} else {
tmp = basestr = camel_header_location_decode(tmp);
}
- printf("content-base is '%s'\n", tmp?tmp:"<unset>");
+ d(printf("content-base is '%s'\n", tmp?tmp:"<unset>"));
if (tmp
&& (base = camel_url_new(tmp, NULL))) {
emf->base = base;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]