[Mono-bugs] [Bug 78241][Maj] Changed - CreateThread failure/out of wapi handles slots

bugzilla-daemon at bugzilla.ximian.com bugzilla-daemon at bugzilla.ximian.com
Wed May 3 08:54:30 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 informatique.internet at fiducial.fr.

http://bugzilla.ximian.com/show_bug.cgi?id=78241

--- shadow/78241	2006-05-03 05:40:17.000000000 -0400
+++ shadow/78241.tmp.9033	2006-05-03 08:54:30.000000000 -0400
@@ -308,6 +308,60 @@
 	 * reference to reach 0 isn't an application bug anyway.
 	 */
 	destroy = (InterlockedDecrement (&_WAPI_PRIVATE_HANDLES(idx).ref) ==0);
 
 is there a bug here?
 
+
+------- Additional Comments From informatique.internet at fiducial.fr  2006-05-03 08:54 -------
+I've done a little patch, that add a destructor to the process... So
+closehandle is now called when disposing the process and we the GC
+clean up the reference...
+
+Index: System.Diagnostics/Process.cs
+===================================================================
+--- System.Diagnostics/Process.cs       (révision 60109)
++++ System.Diagnostics/Process.cs       (copie de travail)
+@@ -892,7 +892,7 @@
+                        } else {
+                                stdin_rd = MonoIO.ConsoleInput;
+                                /* This is required to stop the
+-                                * &$*£ing stupid compiler moaning
++                                * &$*ing stupid compiler moaning
+                                 * that stdin_wr is unassigned, below.
+                                 */
+                                stdin_wr = (IntPtr)0;
+@@ -1081,6 +1081,19 @@
+
+                private bool disposed = false;
+
++               ~Process()
++               {
++                       lock(this)
++                       {
++                               if(process_handle!=IntPtr.Zero)
++                               {
++                                      
+Process_free_internal(process_handle);
++                                       process_handle=IntPtr.Zero;
++                               }
++                       }
++               }
++
++
+                protected override void Dispose(bool disposing) {
+                        // Check to see if Dispose has already been
+called.
+                        if(this.disposed == false) {
+@@ -1097,7 +1110,7 @@
+                                        if(process_handle!=IntPtr.Zero) {
+
+                                               
+Process_free_internal(process_handle);
+-                                              
+process_handle=IntPtr.Zero;
++                                              
+//process_handle=IntPtr.Zero;
+                                        }
+
+                                        if (input_stream != null) {
+


More information about the mono-bugs mailing list