[Mono-bugs] [Bug 78315][Nor] Changed - [PATCH][WIN32] Crash in 3 line System.Windows.Forms program

bugzilla-daemon at bugzilla.ximian.com bugzilla-daemon at bugzilla.ximian.com
Wed Sep 6 16:10:43 EDT 2006

Please do not reply to this email- if you want to comment on the bug, go to the
URL shown below and enter your comments there.

Changed by kornelpal at gmail.com.


--- shadow/78315	2006-09-06 12:33:22.000000000 -0400
+++ shadow/78315.tmp.25458	2006-09-06 16:10:42.000000000 -0400
@@ -327,6 +327,20 @@
         Marshal.FreeHGlobal (comInterface);
 ------- Additional Comments From joncham at gmail.com  2006-09-06 12:33 -------
 Robert's suggestion seems to work. Committed and marking as fixed.
+------- Additional Comments From kornelpal at gmail.com  2006-09-06 16:10 -------
+The problem was that ManagedToNativeWrapper had a destructor that 
+was only called when terminating. COM objects are freed using 
+Release so there is no need for a destructor.
+~VtableDestructor seems not to be called by the runtime but adding 
+if (!Environment.HasShutdownStarted) prevents it from running for 
+sure. I added reference counting to COM vtable and will only be 
+freed when there are no objects using it.
+Some Image objects seem not to be finalized by the GC so in fact COM 
+vtable is not freed because GDI+ holds a reference on 

More information about the mono-bugs mailing list