You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@spamassassin.apache.org by fe...@apache.org on 2006/11/27 20:31:23 UTC

svn commit: r479732 - /spamassassin/trunk/lib/Mail/SpamAssassin/Message.pm

Author: felicity
Date: Mon Nov 27 11:31:22 2006
New Revision: 479732

URL: http://svn.apache.org/viewvc?view=rev&rev=479732
Log:
bug 5210: add back Message::finish() since perl's GC may not completely clean up after our tree, and close non-referenced fd's, etc.

Modified:
    spamassassin/trunk/lib/Mail/SpamAssassin/Message.pm

Modified: spamassassin/trunk/lib/Mail/SpamAssassin/Message.pm
URL: http://svn.apache.org/viewvc/spamassassin/trunk/lib/Mail/SpamAssassin/Message.pm?view=diff&rev=479732&r1=479731&r2=479732
==============================================================================
--- spamassassin/trunk/lib/Mail/SpamAssassin/Message.pm (original)
+++ spamassassin/trunk/lib/Mail/SpamAssassin/Message.pm Mon Nov 27 11:31:22 2006
@@ -516,9 +516,24 @@
   # Clean ourself up
   $self->finish_metadata();
 
-  # wipe out all of our pointers and such -- since our tree is one-way, wiping
-  # out body_parts here will wipe out the rest of the tree.
-  %{$self} = ();
+  my @toclean = ( $self );
+  while (my $part = shift @toclean) {
+    undef $part->{'headers'};
+    undef $part->{'raw_headers'};
+    undef $part->{'header_order'};
+    undef $part->{'raw'};
+    undef $part->{'decoded'};
+    undef $part->{'rendered'};
+    undef $part->{'visible_rendered'};
+    undef $part->{'invisible_rendered'};
+    undef $part->{'type'};
+    undef $part->{'rendered_type'};
+
+    if (exists $part->{'body_parts'}) {
+      push(@toclean, @{$self->{'body_parts'}});
+      undef $self->{'body_parts'};
+    }
+  }
 }
 
 # ---------------------------------------------------------------------------