pan-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Pan-devel] gmime filter unref patch


From: Jeffrey Stedfast
Subject: [Pan-devel] gmime filter unref patch
Date: 04 Mar 2003 21:28:53 -0500

The following patch, once pan's gmime tree is synced up with gmime-2-0
cvs, will fix places where the filter objects will need to be unreffed
in order to not leak.

The only thing that needs to be addressed that I know of before pan
syncs up gmime is to figure out what is to be done about the change in
message-id parsing.

pan's gmime doesn't do any parsing, it just gets the full
<address@hidden> msg-id string, while newer gmime's will return
address@hidden

the advantage of this is that it is theoretically possible to embed
comments into an addr-spec (which is basically what a msg-id is defined
as) and therefor using an unparsed string and using it to match against
other msg-ids is technically incorrect (although probably works 99.99%
of the time).

so... what does this mean:

1. g_mime_message_set_message_id () now takes a msg-id string without
the enclosing <>'s

2. g_mime_message_get_message_id () will return the parsed addr-spec
portion of the msg-id (ie, the returned string will not contain
enclosing <>'s)

I don't know enough about pan internals to know what this affects, so I
can't really comment beyond what I've already said...

my guess is that the set_message_id() change shouldn't be an issue.
Worst comes to worst, you can just use the gmime-utils function to
decode the message-id you were about to set and instead pass in the
resulting string buf.

As always, I'm available for questioning should it be required :-)

(also note that I don't expect a gmime sync to happen for a bit yet, as
Charles mentioned to me on irc that he wants to finish up with the
changes he's making to other areas first).

Jeff

? autom4te.cache
? filter-unref.patch
? iconv-detect.h
? pan/xpm/pan-pixbufs-internal.h
? pan/xpm/pan-pixbufs.h
? tests/data/messages/Makefile.in
? tests/data/messages/cache/Makefile.in
Index: ChangeLog
===================================================================
RCS file: /cvs/gnome/pan/ChangeLog,v
retrieving revision 1.1717
diff -u -r1.1717 ChangeLog
--- ChangeLog   5 Mar 2003 00:33:14 -0000       1.1717
+++ ChangeLog   5 Mar 2003 02:02:48 -0000
@@ -1,3 +1,16 @@
+2003-03-04  Jeffrey Stedfast  <address@hidden>
+
+       * pan/text.c (insert_part_partfunc): Unref the yenc filter.
+
+       * pan/message-window.c (populate_message_from_mw): Unref the
+       charset filter.
+
+       * pan/base/util-mime.c (handle_inline_encoded_data): Unref the
+       uudecode filter object.
+
+       * pan/base/decode.c (decode_article): Unref the yenc_filter object
+       at cleanup time.
+
 2003-03-04  Christophe Lambin <address@hidden>
 
        * pan/prefs.c (prefs_apply): fixed GTK assertion failures.
Index: pan/message-window.c
===================================================================
RCS file: /cvs/gnome/pan/pan/message-window.c,v
retrieving revision 1.348
diff -u -r1.348 message-window.c
--- pan/message-window.c        2 Mar 2003 19:19:05 -0000       1.348
+++ pan/message-window.c        5 Mar 2003 02:02:49 -0000
@@ -2600,6 +2600,7 @@
 
                        g_mime_stream_unref (charset_stream);
                        g_mime_stream_unref (original_stream);
+                       g_object_unref (charset_filter);
                        g_object_unref (data_wrapper);
                }
        }
Index: pan/text.c
===================================================================
RCS file: /cvs/gnome/pan/pan/text.c,v
retrieving revision 1.342
diff -u -r1.342 text.c
--- pan/text.c  5 Mar 2003 00:33:15 -0000       1.342
+++ pan/text.c  5 Mar 2003 02:02:50 -0000
@@ -493,12 +493,15 @@
        if (yenc!= NULL && part->content!=NULL && part->content->stream!=NULL)
        {
                GMimeStream * stream;
+               GMimeFilter * filter;
               
                stream = g_mime_stream_filter_new_with_stream 
(part->content->stream);
-               g_mime_stream_filter_add (GMIME_STREAM_FILTER(stream), 
g_mime_filter_yenc_new (GMIME_FILTER_YENC_DIRECTION_DECODE));
+               filter = g_mime_filter_yenc_new 
(GMIME_FILTER_YENC_DIRECTION_DECODE);
+               g_mime_stream_filter_add (GMIME_STREAM_FILTER(stream), filter);
                g_mime_data_wrapper_set_stream (part->content, stream);
 
                g_mime_stream_unref (stream);
+               g_object_unref (filter);
        }
 
        if (g_mime_content_type_is_type (type, "image", "*"))
Index: pan/base/decode.c
===================================================================
RCS file: /cvs/gnome/pan/pan/base/decode.c,v
retrieving revision 1.55
diff -u -r1.55 decode.c
--- pan/base/decode.c   3 Mar 2003 23:50:42 -0000       1.55
+++ pan/base/decode.c   5 Mar 2003 02:02:50 -0000
@@ -369,6 +369,8 @@
        /* cleanup some more */
        if (mm != NULL)
                g_mime_object_unref (GMIME_OBJECT(mm));
+       if (yenc_filter != NULL)
+               g_object_unref (yenc_filter);
        g_string_free (filenames, TRUE);
        g_ptr_array_free (attachments, TRUE);
        debug_exit ("decode_article");
Index: pan/base/util-mime.c
===================================================================
RCS file: /cvs/gnome/pan/pan/base/util-mime.c,v
retrieving revision 1.52
diff -u -r1.52 util-mime.c
--- pan/base/util-mime.c        26 Dec 2002 18:50:13 -0000      1.52
+++ pan/base/util-mime.c        5 Mar 2003 02:02:50 -0000
@@ -748,6 +748,7 @@
                        GMimePart *subpart = NULL;
                        GMimeStream * filter_stream;
                        GMimeStream * substream;
+                       GMimeFilter * filter;
                        const char * type = NULL;
                        const char * subtype = NULL;
                        
@@ -765,10 +766,12 @@
                                g_mime_part_set_filename (subpart, 
enc_part->decoded_filename);
 
                                filter_stream = 
g_mime_stream_filter_new_with_stream (substream);
-                               g_mime_stream_filter_add (GMIME_STREAM_FILTER 
(filter_stream), g_mime_filter_basic_new_type (GMIME_FILTER_BASIC_UU_DEC));
+                               filter = g_mime_filter_basic_new_type 
(GMIME_FILTER_BASIC_UU_DEC);
+                               g_mime_stream_filter_add (GMIME_STREAM_FILTER 
(filter_stream), filter);
                                content = g_mime_data_wrapper_new_with_stream 
(filter_stream, GMIME_PART_ENCODING_DEFAULT);
                                g_mime_part_set_content_object (subpart, 
content);
                                g_object_unref (content);
+                               g_object_unref (filter);
                                g_mime_stream_unref (filter_stream);
                        }
                        else if (enc_part->type == ENC_YENC)

reply via email to

[Prev in Thread] Current Thread [Next in Thread]