Author: atsushi
Date: 2006-04-03 20:45:46 -0400 (Mon, 03 Apr 2006)
New Revision: 58992

Modified:
   trunk/mcs/class/System/System.IO.Compression/ChangeLog
   trunk/mcs/class/System/System.IO.Compression/DeflateStream.cs
   trunk/mcs/class/System/System.IO.Compression/GzipStream.cs
Log:
2006-04-04  Atsushi Enomoto  <[EMAIL PROTECTED]>

        * DeflateStream.cs GzipStream.cs : updated API to 2.0 RTM.
          Dispose() should certainly release resources than the finalizer.



Modified: trunk/mcs/class/System/System.IO.Compression/ChangeLog
===================================================================
--- trunk/mcs/class/System/System.IO.Compression/ChangeLog      2006-04-04 
00:39:11 UTC (rev 58991)
+++ trunk/mcs/class/System/System.IO.Compression/ChangeLog      2006-04-04 
00:45:46 UTC (rev 58992)
@@ -1,3 +1,8 @@
+2006-04-04  Atsushi Enomoto  <[EMAIL PROTECTED]>
+
+       * DeflateStream.cs GzipStream.cs : updated API to 2.0 RTM.
+         Dispose() should certainly release resources than the finalizer.
+
 2006-03-11  Miguel de Icaza  <[EMAIL PROTECTED]>
 
        * DeflateStream.cs: Comment out DllImport that was not being

Modified: trunk/mcs/class/System/System.IO.Compression/DeflateStream.cs
===================================================================
--- trunk/mcs/class/System/System.IO.Compression/DeflateStream.cs       
2006-04-04 00:39:11 UTC (rev 58991)
+++ trunk/mcs/class/System/System.IO.Compression/DeflateStream.cs       
2006-04-04 00:45:46 UTC (rev 58992)
@@ -101,13 +101,23 @@
                public DeflateStream (Stream compressedStream, CompressionMode 
mode, bool leaveOpen) :
                        this (compressedStream, mode, leaveOpen, false) { }
 
-               ~DeflateStream () {
-                       Marshal.FreeHGlobal (sized_buffer);
+               protected override void Dispose (bool disposing)
+               {
+                       try {
+                               FlushInternal (true);
+                               base.Dispose (disposing);
+                       } finally {
+                               try {
+                                       DisposeCore ();
+                               } finally {
+                                       if (disposing)
+                                               Marshal.FreeHGlobal 
(sized_buffer);
+                               }
+                       }
                }
 
-               public override void Close () {
-                       FlushInternal (true);
-
+               void DisposeCore ()
+               {
                        if (/*mode == CompressionMode.Decompress &&*/ 
compressedStream.CanSeek) {
                                int avail_in = z_stream_get_avail_in (z_stream);
                                if (avail_in != 0) {

Modified: trunk/mcs/class/System/System.IO.Compression/GzipStream.cs
===================================================================
--- trunk/mcs/class/System/System.IO.Compression/GzipStream.cs  2006-04-04 
00:39:11 UTC (rev 58991)
+++ trunk/mcs/class/System/System.IO.Compression/GzipStream.cs  2006-04-04 
00:45:46 UTC (rev 58992)
@@ -48,8 +48,13 @@
                        this.deflateStream = new DeflateStream 
(compressedStream, mode, leaveOpen, true);
                }
 
-               public override void Close () {
-                       deflateStream.Close();
+               protected override void Dispose (bool disposing)
+               {
+                       try {
+                               base.Dispose (disposing);
+                       } finally {
+                               deflateStream.Dispose (disposing);
+                       }
                }
 
                public override int Read (byte[] dest, int dest_offset, int 
count)

_______________________________________________
Mono-patches maillist  -  [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches

Reply via email to