Author: joncham
Date: 2006-08-28 14:54:46 -0400 (Mon, 28 Aug 2006)
New Revision: 64485

Modified:
   trunk/mcs/class/System.Drawing/System.Drawing/ChangeLog
   trunk/mcs/class/System.Drawing/System.Drawing/ComIStreamMarshaler.cs
Log:
2006-08-28  Jonathan Chambers  <[EMAIL PROTECTED]> 

        * ComIStreamMarshaler.cs: Do not free memory allocated for
        Com Callable Wrapper for stream. When Image created from stream
        is destroyed, it calls Release on CCW interface. Somehow we seem
        to be destroying Stream CCW before Image is destroyed. Fixes
        crash on exit on Windows. #78315


Modified: trunk/mcs/class/System.Drawing/System.Drawing/ChangeLog
===================================================================
--- trunk/mcs/class/System.Drawing/System.Drawing/ChangeLog     2006-08-28 
18:28:02 UTC (rev 64484)
+++ trunk/mcs/class/System.Drawing/System.Drawing/ChangeLog     2006-08-28 
18:54:46 UTC (rev 64485)
@@ -1,3 +1,11 @@
+2006-08-28  Jonathan Chambers  <[EMAIL PROTECTED]> 
+
+       * ComIStreamMarshaler.cs: Do not free memory allocated for
+       Com Callable Wrapper for stream. When Image created from stream
+       is destroyed, it calls Release on CCW interface. Somehow we seem
+       to be destroying Stream CCW before Image is destroyed. Fixes
+       crash on exit on Windows. #78315
+       
 2006-08-28     Boris Kirzner   <[EMAIL PROTECTED]>
 
        * SystemColors.jvm.cs: fix array size for NET_2_0

Modified: trunk/mcs/class/System.Drawing/System.Drawing/ComIStreamMarshaler.cs
===================================================================
--- trunk/mcs/class/System.Drawing/System.Drawing/ComIStreamMarshaler.cs        
2006-08-28 18:28:02 UTC (rev 64484)
+++ trunk/mcs/class/System.Drawing/System.Drawing/ComIStreamMarshaler.cs        
2006-08-28 18:54:46 UTC (rev 64485)
@@ -177,7 +177,17 @@
 
                        private void Dispose(bool disposing)
                        {
-                               Marshal.FreeHGlobal(comInterface);
+                               // FIXME: This causes crash on windows on 
shutdown.
+                               // Any image loaded from a stream holds onto a 
reference
+                               // to that stream, and calls Release on the 
stream when the image is
+                               // disposed. Somehow, we are getting destroyed 
before the image is
+                               // even though we are using a GC handle (maybe 
GCHandles are ignored on shutdown)?
+                               // in any cause I think leaking a pointer per 
image for now is
+                               // better than crashing on windows.
+                               // Need to talk to Paolo about having an 
unmanaged resource (IStream) in one managed
+                               // object that another unmanaged resource 
(Image) in another managed object depends on.
+
+                               //Marshal.FreeHGlobal(comInterface);
                                gcHandle.Free();
                                if (disposing)
                                {

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

Reply via email to