summaryrefslogtreecommitdiff
path: root/mcs/class/System/System.Timers/Timer.cs
diff options
context:
space:
mode:
Diffstat (limited to 'mcs/class/System/System.Timers/Timer.cs')
-rw-r--r--mcs/class/System/System.Timers/Timer.cs8
1 files changed, 7 insertions, 1 deletions
diff --git a/mcs/class/System/System.Timers/Timer.cs b/mcs/class/System/System.Timers/Timer.cs
index d35ee4e0eb..28a7011bb5 100644
--- a/mcs/class/System/System.Timers/Timer.cs
+++ b/mcs/class/System/System.Timers/Timer.cs
@@ -159,7 +159,13 @@ namespace System.Timers
protected override void Dispose (bool disposing)
{
- Close ();
+ // If we're disposing explicitly, clear all
+ // fields. If not, all fields will have been
+ // nulled by the GC during finalization, so
+ // trying to lock on _lock will blow up.
+ if (disposing)
+ Close ();
+
base.Dispose (disposing);
}