From 87e5478163ae9a93251645fd59ddd5174b8c6cad Mon Sep 17 00:00:00 2001 From: Michael Meeks Date: Mon, 27 Mar 2000 21:33:34 +0000 Subject: [PATCH] fix nastiness with mime dispositions ( at least for now ) --- camel/ChangeLog | 8 ++++++++ camel/camel-data-wrapper.c | 2 +- camel/camel-mime-part.c | 9 +++++---- camel/gmime-content-field.c | 5 +++-- 4 files changed, 17 insertions(+), 7 deletions(-) diff --git a/camel/ChangeLog b/camel/ChangeLog index d70074b..396fdec 100644 --- a/camel/ChangeLog +++ b/camel/ChangeLog @@ -1,3 +1,11 @@ +2000-03-27 Michael Meeks + + * camel-mime-part.c (my_set_disposition): fix so less broken. + (my_finalize): remove dodgy disposition free. + + * camel-data-wrapper.c (my_set_mime_type_field): unref instead of + free on mime_type. + 2000-03-27 Dan Winship * camel-service.c (camel_service_free_auth_types): new routine to diff --git a/camel/camel-data-wrapper.c b/camel/camel-data-wrapper.c index 0c330c8..1cf79a7 100644 --- a/camel/camel-data-wrapper.c +++ b/camel/camel-data-wrapper.c @@ -363,7 +363,7 @@ camel_data_wrapper_get_mime_type_field (CamelDataWrapper *data_wrapper) static void my_set_mime_type_field (CamelDataWrapper *data_wrapper, GMimeContentField *mime_type) { - if (data_wrapper->mime_type) gmime_content_field_free (data_wrapper->mime_type); + if (data_wrapper->mime_type) gmime_content_field_unref (data_wrapper->mime_type); data_wrapper->mime_type = mime_type; } diff --git a/camel/camel-mime-part.c b/camel/camel-mime-part.c index 7214738..28f3135 100644 --- a/camel/camel-mime-part.c +++ b/camel/camel-mime-part.c @@ -243,7 +243,6 @@ my_finalize (GtkObject *object) CAMEL_LOG_FULL_DEBUG ("Entering CamelMimePart::finalize\n"); g_free (mime_part->description); - gmime_content_field_unref (mime_part->disposition); g_free (mime_part->content_id); g_free (mime_part->content_MD5); string_list_free (mime_part->content_languages); @@ -320,11 +319,13 @@ my_set_disposition (CamelMimePart *mime_part, const gchar *disposition) { #warning Do not use MimeContentfield here !!! - if (mime_part->disposition) g_free ((mime_part->disposition)->type); - g_free (mime_part->disposition); + if (mime_part->disposition) { + g_free (mime_part->disposition->type); + g_free (mime_part->disposition); + } mime_part->disposition = g_new0 (GMimeContentField,1); - (mime_part->disposition)->type = g_strdup (disposition); + mime_part->disposition->type = g_strdup (disposition); } diff --git a/camel/gmime-content-field.c b/camel/gmime-content-field.c index 7f93ae1..6788332 100644 --- a/camel/gmime-content-field.c +++ b/camel/gmime-content-field.c @@ -52,7 +52,7 @@ gmime_content_field_new (const gchar *type, const gchar *subtype) ctf = g_new (GMimeContentField, 1); ctf->type = g_strdup (type); ctf->subtype = g_strdup (subtype); - ctf->parameters = g_hash_table_new (g_strcase_hash, g_strcase_equal); + ctf->parameters = g_hash_table_new (g_strcase_hash, g_strcase_equal); ctf->ref = 1; return ctf; @@ -79,6 +79,8 @@ gmime_content_field_free (GMimeContentField *content_field) { if (!content_field) return; + g_assert (content_field->ref <= 0); + g_hash_table_foreach (content_field->parameters, _free_parameter, NULL); g_free (content_field->type); g_free (content_field->subtype); @@ -293,7 +295,6 @@ void gmime_content_field_construct_from_string (GMimeContentField *content_field, const gchar *string) { gint first, len; - gchar *str; gint i=0; gchar *type, *subtype; gchar *param_name, *param_value; -- 2.7.4