From 82ca716cca8cd879becc13bd5351d296ef67693e Mon Sep 17 00:00:00 2001 From: Dariusz Komosinski Date: Thu, 20 May 2021 01:32:23 +0200 Subject: [PATCH] Remove ref counting from ClockBase. --- src/Avalonia.Animation/ClockBase.cs | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/src/Avalonia.Animation/ClockBase.cs b/src/Avalonia.Animation/ClockBase.cs index a2b29e728e..9fa6a85a6c 100644 --- a/src/Avalonia.Animation/ClockBase.cs +++ b/src/Avalonia.Animation/ClockBase.cs @@ -8,9 +8,7 @@ namespace Avalonia.Animation { public class ClockBase : IClock { - private ClockObservable _observable; - - private IObservable _connectedObservable; + private readonly ClockObservable _observable; private TimeSpan? _previousTime; private TimeSpan _internalTime; @@ -18,7 +16,6 @@ namespace Avalonia.Animation protected ClockBase() { _observable = new ClockObservable(); - _connectedObservable = _observable.Publish().RefCount(); } protected bool HasSubscriptions => _observable.HasSubscriptions; @@ -58,7 +55,7 @@ namespace Avalonia.Animation public IDisposable Subscribe(IObserver observer) { - return _connectedObservable.Subscribe(observer); + return _observable.Subscribe(observer); } private class ClockObservable : LightweightObservableBase