Browse Source
Merge pull request #3958 from AvaloniaUI/fixes/setterbindinginstance-leak
Fix leak in PropertySetterBindingInstance.
pull/3877/head
Dariusz Komosiński
6 years ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with
7 additions and
3 deletions
-
src/Avalonia.Styling/Styling/PropertySetterBindingInstance.cs
|
|
|
@ -24,6 +24,7 @@ namespace Avalonia.Styling |
|
|
|
private BindingValue<T> _value; |
|
|
|
private IDisposable? _subscription; |
|
|
|
private IDisposable? _subscriptionTwoWay; |
|
|
|
private IDisposable? _innerSubscription; |
|
|
|
private bool _isActive; |
|
|
|
|
|
|
|
public PropertySetterBindingInstance( |
|
|
|
@ -121,6 +122,9 @@ namespace Avalonia.Styling |
|
|
|
sub.Dispose(); |
|
|
|
} |
|
|
|
|
|
|
|
_innerSubscription?.Dispose(); |
|
|
|
_innerSubscription = null; |
|
|
|
|
|
|
|
base.Dispose(); |
|
|
|
} |
|
|
|
|
|
|
|
@ -144,13 +148,13 @@ namespace Avalonia.Styling |
|
|
|
|
|
|
|
protected override void Subscribed() |
|
|
|
{ |
|
|
|
_subscription = _binding.Observable.Subscribe(_inner); |
|
|
|
_innerSubscription = _binding.Observable.Subscribe(_inner); |
|
|
|
} |
|
|
|
|
|
|
|
protected override void Unsubscribed() |
|
|
|
{ |
|
|
|
_subscription?.Dispose(); |
|
|
|
_subscription = null; |
|
|
|
_innerSubscription?.Dispose(); |
|
|
|
_innerSubscription = null; |
|
|
|
} |
|
|
|
|
|
|
|
private void PublishNext() |
|
|
|
|