2006-09-04 Jonathan Chambers <joncham@gmail.com>
authorJonathan Chambers <joncham@gmail.com>
Tue, 5 Sep 2006 00:49:09 +0000 (00:49 -0000)
committerJonathan Chambers <joncham@gmail.com>
Tue, 5 Sep 2006 00:49:09 +0000 (00:49 -0000)
* ComIStreamMarshaler.cs: Do not deallocate unmanaged memory
allocated for vtable. If this finalizer runs before all clients
are done with it (Image(s) in this case) we crash on windows. #78315

svn path=/trunk/mcs/; revision=64909

mcs/class/System.Drawing/System.Drawing/ChangeLog
mcs/class/System.Drawing/System.Drawing/ComIStreamMarshaler.cs

index e69141a9cc1fca8156d4bd88d9895751e19a3ecf..3c1085b3251d31b8bd493ab897f2f5cddd6e6cec 100644 (file)
@@ -1,3 +1,9 @@
+2006-09-04  Jonathan Chambers  <joncham@gmail.com> 
+
+       * ComIStreamMarshaler.cs: Do not deallocate unmanaged memory
+       allocated for vtable. If this finalizer runs before all clients
+       are done with it (Image(s) in this case) we crash on windows. #78315
+       
 2006-09-01  Sebastien Pouliot  <sebastien@ximian.com>
 
        * Bitmap.cs: Fix exceptions for LockBits.
index c2b4d1859aa893daeb16434f01b03d714a17a087..9805a07066273d23ca4043efc1de0d67209589dd 100644 (file)
@@ -107,13 +107,17 @@ namespace System.Drawing
                                internal ReleaseDelegate Release;
                        }
 
-                       private sealed class VtableDestructor
-                       {
-                               ~VtableDestructor()
-                               {
-                                       Marshal.DestroyStructure(comVtable, typeof(IStreamVtbl));
-                                       Marshal.FreeHGlobal(comVtable);
-                               }
+                       private sealed class VtableDestructor\r
+                       {\r
+                               // FIXME: This causes crash on windows on shutdown.\r
+                               // Any image loaded from a stream holds onto a reference\r
+                               // to that stream, and calls Release on the stream when the image is\r
+                               // disposed. 
+                               //~VtableDestructor()\r
+                               //{                             
+                                       //Marshal.DestroyStructure(comVtable, typeof(IStreamVtbl));
+                                       //Marshal.FreeHGlobal(comVtable);
+                               //}
                        }
 
                        private static readonly Guid IID_IUnknown = new Guid("00000000-0000-0000-C000-000000000046");