+2006-08-28 Jonathan Chambers <joncham@gmail.com>
+
+ * 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 <borisk@mainsoft.com>
* SystemColors.jvm.cs: fix array size for NET_2_0
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)
{