[evolution] Don't close base stream when destroying a CamelFilterOutputStream.
- From: Matthew Barnes <mbarnes src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [evolution] Don't close base stream when destroying a CamelFilterOutputStream.
- Date: Mon, 10 Mar 2014 16:46:01 +0000 (UTC)
commit 130b1b00ece4ec57b8d0fcfcee1bdf508d709736
Author: Matthew Barnes <mbarnes redhat com>
Date: Mon Mar 10 12:45:17 2014 -0400
Don't close base stream when destroying a CamelFilterOutputStream.
GFilterOutputStream, from which CamelFilterOutputStream is derived,
defaults to closing its base stream when the instance is finalized.
That makes sense in the general case, but CamelFilterOutputStreams are
usually temporary wrappers on a more permanent base stream, so we need
to remember to override the default "close-base-stream" property value.
I was tempted to just make CamelFilterOutputStream override the default
automatically, but I decided against it because my long term plan is to
drop CamelFilterOutputStream for GConverterOutputStream which also does
not override the "close-base-stream" default. The closer the semantics
of the two classes match, the easier porting will be in the future.
em-format/e-mail-formatter-error.c | 2 ++
em-format/e-mail-formatter-quote-text-enriched.c | 2 ++
em-format/e-mail-formatter-quote-text-html.c | 2 ++
em-format/e-mail-formatter-quote-text-plain.c | 4 ++++
em-format/e-mail-formatter-source.c | 2 ++
em-format/e-mail-formatter-text-enriched.c | 2 ++
em-format/e-mail-formatter-text-plain.c | 2 ++
em-format/e-mail-formatter.c | 4 ++++
8 files changed, 20 insertions(+), 0 deletions(-)
---
diff --git a/em-format/e-mail-formatter-error.c b/em-format/e-mail-formatter-error.c
index 117fcd6..10993d7 100644
--- a/em-format/e-mail-formatter-error.c
+++ b/em-format/e-mail-formatter-error.c
@@ -78,6 +78,8 @@ emfe_error_format (EMailFormatterExtension *extension,
CAMEL_MIME_FILTER_TOHTML_CONVERT_NL |
CAMEL_MIME_FILTER_TOHTML_CONVERT_URLS, 0);
filtered_stream = camel_filter_output_stream_new (stream, filter);
+ g_filter_output_stream_set_close_base_stream (
+ G_FILTER_OUTPUT_STREAM (filtered_stream), FALSE);
g_object_unref (filter);
camel_data_wrapper_decode_to_output_stream_sync (
diff --git a/em-format/e-mail-formatter-quote-text-enriched.c
b/em-format/e-mail-formatter-quote-text-enriched.c
index 390bbd6..679ab7c 100644
--- a/em-format/e-mail-formatter-quote-text-enriched.c
+++ b/em-format/e-mail-formatter-quote-text-enriched.c
@@ -75,6 +75,8 @@ emqfe_text_enriched_format (EMailFormatterExtension *extension,
filter = camel_mime_filter_enriched_new (camel_flags);
filtered_stream = camel_filter_output_stream_new (stream, filter);
+ g_filter_output_stream_set_close_base_stream (
+ G_FILTER_OUTPUT_STREAM (filtered_stream), FALSE);
g_object_unref (filter);
e_mail_formatter_format_text (
diff --git a/em-format/e-mail-formatter-quote-text-html.c b/em-format/e-mail-formatter-quote-text-html.c
index 5ae94f7..f6a47a9 100644
--- a/em-format/e-mail-formatter-quote-text-html.c
+++ b/em-format/e-mail-formatter-quote-text-html.c
@@ -72,6 +72,8 @@ emqfe_text_html_format (EMailFormatterExtension *extension,
filter = e_mail_stripsig_filter_new (FALSE);
temp_stream = camel_filter_output_stream_new (
filtered_stream, filter);
+ g_filter_output_stream_set_close_base_stream (
+ G_FILTER_OUTPUT_STREAM (temp_stream), FALSE);
g_object_unref (filtered_stream);
filtered_stream = temp_stream;
g_object_unref (filter);
diff --git a/em-format/e-mail-formatter-quote-text-plain.c b/em-format/e-mail-formatter-quote-text-plain.c
index d53cc53..318762c 100644
--- a/em-format/e-mail-formatter-quote-text-plain.c
+++ b/em-format/e-mail-formatter-quote-text-plain.c
@@ -89,6 +89,8 @@ emqfe_text_plain_format (EMailFormatterExtension *extension,
filter = e_mail_stripsig_filter_new (TRUE);
temp_stream = camel_filter_output_stream_new (
filtered_stream, filter);
+ g_filter_output_stream_set_close_base_stream (
+ G_FILTER_OUTPUT_STREAM (temp_stream), FALSE);
g_object_unref (filtered_stream);
filtered_stream = temp_stream;
g_object_unref (filter);
@@ -96,6 +98,8 @@ emqfe_text_plain_format (EMailFormatterExtension *extension,
filter = camel_mime_filter_tohtml_new (text_flags, rgb);
temp_stream = camel_filter_output_stream_new (filtered_stream, filter);
+ g_filter_output_stream_set_close_base_stream (
+ G_FILTER_OUTPUT_STREAM (temp_stream), FALSE);
g_object_unref (filtered_stream);
filtered_stream = temp_stream;
g_object_unref (filter);
diff --git a/em-format/e-mail-formatter-source.c b/em-format/e-mail-formatter-source.c
index 4c80114..ed7304f 100644
--- a/em-format/e-mail-formatter-source.c
+++ b/em-format/e-mail-formatter-source.c
@@ -85,6 +85,8 @@ emfe_source_format (EMailFormatterExtension *extension,
CAMEL_MIME_FILTER_TOHTML_CONVERT_SPACES |
CAMEL_MIME_FILTER_TOHTML_PRESERVE_8BIT, 0);
filtered_stream = camel_filter_output_stream_new (stream, filter);
+ g_filter_output_stream_set_close_base_stream (
+ G_FILTER_OUTPUT_STREAM (filtered_stream), FALSE);
g_object_unref (filter);
camel_data_wrapper_write_to_output_stream_sync (
diff --git a/em-format/e-mail-formatter-text-enriched.c b/em-format/e-mail-formatter-text-enriched.c
index 8e52223..e9fccd7 100644
--- a/em-format/e-mail-formatter-text-enriched.c
+++ b/em-format/e-mail-formatter-text-enriched.c
@@ -66,6 +66,8 @@ emfe_text_enriched_format (EMailFormatterExtension *extension,
filter = camel_mime_filter_enriched_new (filter_flags);
filtered_stream = camel_filter_output_stream_new (stream, filter);
+ g_filter_output_stream_set_close_base_stream (
+ G_FILTER_OUTPUT_STREAM (filtered_stream), FALSE);
g_object_unref (filter);
string =
diff --git a/em-format/e-mail-formatter-text-plain.c b/em-format/e-mail-formatter-text-plain.c
index c759a0a..373ffdf 100644
--- a/em-format/e-mail-formatter-text-plain.c
+++ b/em-format/e-mail-formatter-text-plain.c
@@ -105,6 +105,8 @@ emfe_text_plain_format (EMailFormatterExtension *extension,
filter = camel_mime_filter_tohtml_new (flags, rgb);
filtered_stream =
camel_filter_output_stream_new (stream, filter);
+ g_filter_output_stream_set_close_base_stream (
+ G_FILTER_OUTPUT_STREAM (filtered_stream), FALSE);
g_object_unref (filter);
string =
diff --git a/em-format/e-mail-formatter.c b/em-format/e-mail-formatter.c
index 374f221..2efe8eb 100644
--- a/em-format/e-mail-formatter.c
+++ b/em-format/e-mail-formatter.c
@@ -1065,6 +1065,8 @@ e_mail_formatter_format_text (EMailFormatter *formatter,
windows = camel_mime_filter_windows_new (charset);
filter_stream = camel_filter_output_stream_new (
null_stream, windows);
+ g_filter_output_stream_set_close_base_stream (
+ G_FILTER_OUTPUT_STREAM (filter_stream), FALSE);
camel_data_wrapper_decode_to_output_stream_sync (
CAMEL_DATA_WRAPPER (mime_part),
@@ -1083,6 +1085,8 @@ e_mail_formatter_format_text (EMailFormatter *formatter,
filter = camel_mime_filter_charset_new (charset, "UTF-8");
if (filter != NULL) {
stream = camel_filter_output_stream_new (stream, filter);
+ g_filter_output_stream_set_close_base_stream (
+ G_FILTER_OUTPUT_STREAM (stream), FALSE);
g_object_unref (filter);
} else {
g_object_ref (stream);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]