Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Proper IDisposable implementation for RDC

  • Loading branch information...
commit d7b345337a496c404ed380b29e332dd18e9fc248 1 parent 08faf15
@niik niik authored paulcbetts committed
Showing with 12 additions and 5 deletions.
  1. +12 −5 ReactiveUI/ReactiveCollectionMixins.cs
View
17 ReactiveUI/ReactiveCollectionMixins.cs
@@ -13,7 +13,12 @@ namespace ReactiveUI
{
public abstract class ReactiveDerivedCollection<TValue> : ReactiveCollection<TValue>, IDisposable
{
- public abstract void Dispose();
+ public void Dispose()
+ {
+ this.Dispose(true);
+ }
+
+ public virtual void Dispose(bool disposing) { }
}
public sealed class ReactiveDerivedCollection<TSource, TValue> : ReactiveDerivedCollection<TValue>, IDisposable
@@ -418,12 +423,14 @@ static int sign(int i)
return (i == 0 ? 0 : i / Math.Abs(i));
}
- public override void Dispose()
+ public override void Dispose(bool disposing)
{
- var disp = Interlocked.Exchange(ref inner, null);
- if (disp == null) return;
+ if (disposing) {
+ var disp = Interlocked.Exchange(ref inner, null);
+ if (disp == null) return;
- disp.Dispose();
+ disp.Dispose();
+ }
}
}
Please sign in to comment.
Something went wrong with that request. Please try again.