aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorbertrand <bertrand@helixcode.com>2000-03-09 03:53:31 +0800
committerBertrand Guiheneuf <bertrand@src.gnome.org>2000-03-09 03:53:31 +0800
commit207a1395e10cbce4f9ec3baa33a649fb9a151a27 (patch)
tree385a02f3528a4b582c38af77c9c98f44032514a5
parent13edeabcd2978c1e7febe005cd3fb2f19c55edc1 (diff)
downloadgsoc2013-evolution-207a1395e10cbce4f9ec3baa33a649fb9a151a27.tar.gz
gsoc2013-evolution-207a1395e10cbce4f9ec3baa33a649fb9a151a27.tar.zst
gsoc2013-evolution-207a1395e10cbce4f9ec3baa33a649fb9a151a27.zip
plug mem leaks due to bad documentation of
2000-03-07 bertrand <bertrand@helixcode.com> * camel-formatter.c (handle_mime_part): plug mem leaks due to bad documentation of camel_content_field_get_mime_type (print_camel_body_part): idem (handle_multipart_alternative): idem * gmime-content-field.c (gmime_content_field_get_mime_type): documentation fix. * camel-mime-part.c (my_finalize): unref the content_input_stream if any. * shell/e-shell-shortcut.c (shortcut_bar_item_selected): removed a test that prevented the standard menu to be shown. svn path=/trunk/; revision=2089
-rw-r--r--ChangeLog6
-rw-r--r--camel/ChangeLog15
-rw-r--r--camel/camel-formatter.c23
-rw-r--r--camel/camel-mime-part.c27
-rw-r--r--camel/camel-recipient.c1
-rw-r--r--camel/gmime-content-field.c2
-rw-r--r--mail/mail-display.c17
-rw-r--r--mail/mail-display.h1
-rw-r--r--mail/message-list.h1
-rw-r--r--shell/e-shell-shortcut.c4
10 files changed, 71 insertions, 26 deletions
diff --git a/ChangeLog b/ChangeLog
index 4df661bd6f..0d991f9853 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2000-03-07 bertrand <bertrand@helixcode.com>
+
+ * shell/e-shell-shortcut.c (shortcut_bar_item_selected):
+ removed a test that prevented the standard menu
+ to be shown.
+
2000-03-07 Christopher James Lahey <clahey@helixcode.com>
* widgets/e-text/e-text.c, widgets/e-text/e-text.h: Added a
diff --git a/camel/ChangeLog b/camel/ChangeLog
index ba5b29d876..ad11e5efe9 100644
--- a/camel/ChangeLog
+++ b/camel/ChangeLog
@@ -1,3 +1,18 @@
+2000-03-07 bertrand <bertrand@helixcode.com>
+
+ * camel-formatter.c (handle_mime_part):
+ plug mem leaks due to bad documentation
+ of camel_content_field_get_mime_type
+ (print_camel_body_part): idem
+ (handle_multipart_alternative): idem
+
+ * gmime-content-field.c (gmime_content_field_get_mime_type):
+ documentation fix.
+
+
+ * camel-mime-part.c (my_finalize): unref the
+ content_input_stream if any.
+
2000-03-06 bertrand <bertrand@helixcode.com>
* camel-stream-fs.c (_seek): fix a bogus calculation
diff --git a/camel/camel-formatter.c b/camel/camel-formatter.c
index 3ab86b7435..b1caf9f6fc 100644
--- a/camel/camel-formatter.c
+++ b/camel/camel-formatter.c
@@ -778,11 +778,13 @@ handle_mime_part (CamelFormatter *formatter,
{
CamelMimePart* mime_part;
CamelDataWrapper* message_contents;
+ gchar *whole_mime_type;
g_assert (formatter);
g_assert (wrapper);
g_assert (CAMEL_IS_MIME_PART (wrapper));
+
mime_part = CAMEL_MIME_PART (wrapper);
message_contents =
camel_medium_get_content_object (CAMEL_MEDIUM (mime_part));
@@ -797,10 +799,12 @@ handle_mime_part (CamelFormatter *formatter,
// "<table width=95% border=1><tr><td>\n\n");
/* dispatch the correct handler function for the mime type */
+ whole_mime_type = MIME_TYPE_WHOLE (mime_part);
call_handler_function (formatter, message_contents,
- MIME_TYPE_WHOLE (mime_part),
+ whole_mime_type,
MIME_TYPE_MAIN (mime_part));
-
+ g_free (whole_mime_type);
+
/* close up the table we opened */
// camel_stream_write_string (formatter->priv->stream,
// "\n\n</td></tr></table>\n\n");
@@ -855,6 +859,8 @@ print_camel_body_part (CamelMimeBodyPart* body_part,
CamelFormatter* formatter,
gboolean* text_printed_yet)
{
+ gchar *whole_mime_type;
+
CamelDataWrapper* contents =
camel_medium_get_content_object (CAMEL_MEDIUM (body_part));
gboolean is_text =
@@ -862,9 +868,11 @@ print_camel_body_part (CamelMimeBodyPart* body_part,
if (is_text && *text_printed_yet)
return;
-
- call_handler_function (formatter, contents, MIME_TYPE_WHOLE (body_part),
+ whole_mime_type = MIME_TYPE_WHOLE (body_part);
+ call_handler_function (formatter, contents, whole_mime_type,
MIME_TYPE_MAIN (body_part));
+ g_free (whole_mime_type);
+
camel_stream_write_string (formatter->priv->stream, "\n\n");
/* use this when gtktmhl is fixed */
/* camel_stream_write_string (formatter->priv->stream, "\n<hr>\n"); */
@@ -940,7 +948,8 @@ handle_multipart_alternative (CamelFormatter *formatter,
{
CamelMultipart* multipart = CAMEL_MULTIPART (wrapper);
CamelMimePart* mime_part;
-
+ gchar *whole_mime_type;
+
debug ("handle_multipart_alternative: entered\n");
mime_part =
@@ -952,9 +961,11 @@ handle_multipart_alternative (CamelFormatter *formatter,
camel_medium_get_content_object (
CAMEL_MEDIUM (mime_part));
+ whole_mime_type = MIME_TYPE_WHOLE (mime_part);
call_handler_function (formatter, contents,
- MIME_TYPE_WHOLE (mime_part),
+ whole_mime_type,
MIME_TYPE_MAIN (mime_part));
+ g_free (whole_mime_type);
}
debug ("handle_multipart_alternative: exiting\n");
diff --git a/camel/camel-mime-part.c b/camel/camel-mime-part.c
index 953ee0d077..56ebe4fd89 100644
--- a/camel/camel-mime-part.c
+++ b/camel/camel-mime-part.c
@@ -191,18 +191,18 @@ camel_mime_part_init (gpointer object, gpointer klass)
{
CamelMimePart *camel_mime_part = CAMEL_MIME_PART (object);
- camel_mime_part->content_type = gmime_content_field_new (NULL, NULL);
- camel_mime_part->description = NULL;
- camel_mime_part->disposition = NULL;
- camel_mime_part->content_id = NULL;
- camel_mime_part->content_MD5 = NULL;
- camel_mime_part->content_languages = NULL;
- camel_mime_part->encoding = CAMEL_MIME_PART_ENCODING_DEFAULT;
- camel_mime_part->filename = NULL;
- camel_mime_part->header_lines = NULL;
-
- camel_mime_part->temp_message_buffer = NULL;
+ camel_mime_part->content_type = gmime_content_field_new (NULL, NULL);
+ camel_mime_part->description = NULL;
+ camel_mime_part->disposition = NULL;
+ camel_mime_part->content_id = NULL;
+ camel_mime_part->content_MD5 = NULL;
+ camel_mime_part->content_languages = NULL;
+ camel_mime_part->encoding = CAMEL_MIME_PART_ENCODING_DEFAULT;
+ camel_mime_part->filename = NULL;
+ camel_mime_part->header_lines = NULL;
+ camel_mime_part->temp_message_buffer = NULL;
+ camel_mime_part->content_input_stream = NULL;
}
@@ -253,6 +253,8 @@ my_finalize (GtkObject *object)
if (mime_part->content_type) gmime_content_field_unref (mime_part->content_type);
if (mime_part->temp_message_buffer) g_byte_array_free (mime_part->temp_message_buffer, TRUE);
+ if (mime_part->content_input_stream) gtk_object_unref (GTK_OBJECT (mime_part->content_input_stream));
+
GTK_OBJECT_CLASS (parent_class)->finalize (object);
CAMEL_LOG_FULL_DEBUG ("Leaving CamelMimePart::finalize\n");
}
@@ -870,6 +872,9 @@ my_set_input_stream (CamelDataWrapper *data_wrapper, CamelStream *stream)
/* set the input stream for the content object */
content_stream_inf_bound = camel_seekable_stream_get_current_position (seekable_stream);
printf ("Current position = %d\n", content_stream_inf_bound);
+
+ if (mime_part->content_input_stream)
+ gtk_object_unref (mime_part->content_input_stream);
mime_part->content_input_stream = camel_seekable_substream_new_with_seekable_stream_and_bounds (seekable_stream,
content_stream_inf_bound,
-1);
diff --git a/camel/camel-recipient.c b/camel/camel-recipient.c
index 7b42cdc9a0..095151d2ff 100644
--- a/camel/camel-recipient.c
+++ b/camel/camel-recipient.c
@@ -79,6 +79,7 @@ _free_recipient_list (gpointer key, gpointer value, gpointer user_data)
recipient_list = recipient_list->next;
}
+ g_list_free ((GList *)value);
g_free (recipient_name);
}
diff --git a/camel/gmime-content-field.c b/camel/gmime-content-field.c
index bec9721e0a..263484fc9b 100644
--- a/camel/gmime-content-field.c
+++ b/camel/gmime-content-field.c
@@ -211,7 +211,7 @@ gmime_content_field_write_to_stream (GMimeContentField *content_field, CamelStre
* A RFC 2045 content type field contains the mime type in the
* form "type/subtype" (example : "application/postscript") and some
* parameters (attribute/value pairs). This routine returns the mime type
- * in a gchar object.
+ * in a gchar object. THIS OBJECT MUST BE FREED BY THE CALLER.
*
* Return value: the mime type in the form "type/subtype" or NULL if not defined.
**/
diff --git a/mail/mail-display.c b/mail/mail-display.c
index 6665d8dd48..3f5cbd2bcf 100644
--- a/mail/mail-display.c
+++ b/mail/mail-display.c
@@ -250,6 +250,12 @@ mail_display_set_message (MailDisplay *mail_display,
*/
if (CAMEL_IS_MIME_MESSAGE (medium)) {
+ /* we were given a reference to the message in the last call
+ * to mail_display_set_message, free it now. */
+ if (mail_display->current_message)
+ gtk_object_unref (GTK_OBJECT (mail_display->current_message));
+
+ mail_display->current_message = CAMEL_MIME_MESSAGE (medium);
/*
* reset the html stream to clean
* the gtkhtml widget
@@ -287,13 +293,11 @@ mail_display_set_message (MailDisplay *mail_display,
CAMEL_MIME_MESSAGE (medium),
mail_display->headers_stream,
mail_display->body_stream);
+
-
- /*camel_formatter_wrapper_to_html (camel_formatter,
- CAMEL_DATA_WRAPPER (medium),
- mail_display->body_stream);*/
+ gtk_object_unref (GTK_OBJECT (camel_formatter));
- camel_stream_write_string (mail_display->headers_stream, "
+ camel_stream_write_string (mail_display->headers_stream, "
</font>
</body>
</html>
@@ -333,6 +337,9 @@ mail_display_init (GtkObject *object)
mail_display->body_stream = html_stream_new (mail_display->body_html_widget);
gtk_widget_show (GTK_WIDGET (mail_display->body_html_widget));
+
+ /* various other initializations */
+ mail_display->current_message = NULL;
}
static void
diff --git a/mail/mail-display.h b/mail/mail-display.h
index 804be904f8..81f1bcb38f 100644
--- a/mail/mail-display.h
+++ b/mail/mail-display.h
@@ -38,6 +38,7 @@ struct _MailDisplay {
GtkHTML * body_html_widget;
CamelStream * body_stream;
+ CamelMimeMessage *current_message;
};
typedef struct {
diff --git a/mail/message-list.h b/mail/message-list.h
index 16e60c21f0..f045037313 100644
--- a/mail/message-list.h
+++ b/mail/message-list.h
@@ -59,6 +59,7 @@ struct _MessageList {
CamelFolder *folder;
CamelFolderSummary *folder_summary;
+
} ;
typedef struct {
diff --git a/shell/e-shell-shortcut.c b/shell/e-shell-shortcut.c
index 56671dccd3..6ac3fc9e1c 100644
--- a/shell/e-shell-shortcut.c
+++ b/shell/e-shell-shortcut.c
@@ -299,9 +299,7 @@ shortcut_bar_item_selected (EShortcutBar *e_shortcut_bar,
return;
shortcut = e_shortcut_from_pos (shortcut_group, item_num);
-
- if (shortcut == NULL)
- return;
+
if (event->button.button == 1) {
e_shell_view_set_view (eshell_view, shortcut->efolder);