Author: miguel
Date: 2007-07-18 19:54:06 -0400 (Wed, 18 Jul 2007)
New Revision: 82258
Modified:
trunk/mcs/class/corlib/System.Threading/ChangeLog
trunk/mcs/class/corlib/System.Threading/WaitHandle.cs
Log:
2007-07-18 Miguel de Icaza <[EMAIL PROTECTED]>
* WaitHandle.cs (Handle): in the 2.0 profile, explicitly dispose
the old SafeWaitHandle, do not wait for the finalizer to run;
Take ownership of the handle; The docs did not say that
assigning to this value would lead to a leak, the docs said that
in the 1.0 and 1.1 profiles assigning to this property might lead
to a leak. My mistake.
Fixes: 82134
Modified: trunk/mcs/class/corlib/System.Threading/ChangeLog
===================================================================
--- trunk/mcs/class/corlib/System.Threading/ChangeLog 2007-07-18 23:26:17 UTC
(rev 82257)
+++ trunk/mcs/class/corlib/System.Threading/ChangeLog 2007-07-18 23:54:06 UTC
(rev 82258)
@@ -1,3 +1,15 @@
+2007-07-18 Miguel de Icaza <[EMAIL PROTECTED]>
+
+ * WaitHandle.cs (Handle): in the 2.0 profile, explicitly dispose
+ the old SafeWaitHandle, do not wait for the finalizer to run;
+
+ Take ownership of the handle; The docs did not say that
+ assigning to this value would lead to a leak, the docs said that
+ in the 1.0 and 1.1 profiles assigning to this property might lead
+ to a leak. My mistake.
+
+ Fixes: 82134
+
2007-07-09 Atsushi Enomoto <[EMAIL PROTECTED]>
* LockCookie.cs, AsyncFlowControl.cs :
Modified: trunk/mcs/class/corlib/System.Threading/WaitHandle.cs
===================================================================
--- trunk/mcs/class/corlib/System.Threading/WaitHandle.cs 2007-07-18
23:26:17 UTC (rev 82257)
+++ trunk/mcs/class/corlib/System.Threading/WaitHandle.cs 2007-07-18
23:54:06 UTC (rev 82258)
@@ -221,12 +221,13 @@
[SecurityPermission (SecurityAction.LinkDemand,
UnmanagedCode = true)]
[SecurityPermission (SecurityAction.InheritanceDemand,
UnmanagedCode = true)]
set {
- //
- // Notice, from the 2.x documentation:
- // Assigning a new value to the Handle
property, will not release
- // the previous handle, this could lead to a
leak
- //
- safe_wait_handle = new SafeWaitHandle (value,
false);
+ if (safe_wait_handle != null)
+ safe_wait_handle.Close ();
+
+ if (value == InvalidHandle)
+ safe_wait_handle = null;
+ else
+ safe_wait_handle = new SafeWaitHandle
(value, true);
}
}
@@ -261,8 +262,8 @@
[ReliabilityContract (Consistency.WillNotCorruptState,
Cer.Success)]
set {
if (safe_wait_handle != null)
- safe_wait_handle.Close ();
-
+ safe_wait_handle.Dispose ();
+
safe_wait_handle = value;
}
}
_______________________________________________
Mono-patches maillist - [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches