[mono/mono] a571d294: Improve my previous change a bit.
| Newsgroups | gmane.comp.gnome.mono.patches |
|---|---|
| Message-ID | <000001423a9112f7-e434b3cb-4eb1-4f79-ad81-9ecb013a9931-000000@email.amazonses.com> |
Branch: refs/heads/master
Home: https://github.com/mono/mono
Compare: https://github.com/mono/mono/compare/2d18195d175b...a571d294992d
Commit: a571d294992d4ecb794de00590d0a5a11167e395
Author: Alex Rønne Petersen <[email protected]>
Date: 2013-11-09 01:52:20 GMT
URL: https://github.com/mono/mono/commit/a571d294992d4ecb794de00590d0a5a11167e395
Improve my previous change a bit.
Checking the `disposing` argument is cleaner.
Changed paths:
M mcs/class/System/System.Timers/Timer.cs
Modified: mcs/class/System/System.Timers/Timer.cs
===================================================================
@@ -159,9 +159,11 @@ public void Stop ()
protected override void Dispose (bool disposing)
{
- // If _lock is null, it means we're finalizing,
- // in which case everything has been nulled anyway.
- if (_lock != null)
+ // 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);
_______________________________________________
Mono-patches maillist - [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches