Skip to content

Commit a09ae4a

Browse files
authored
change the timing to remove PropertyChanged event (#498)
1 parent 199e8ec commit a09ae4a

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

Source/ReactiveProperty.Core/Internals/SimplePropertyObservable.cs

+2-2
Original file line numberDiff line numberDiff line change
@@ -60,8 +60,8 @@ public Subscription(TSubject subject, Func<TSubject, TProperty> accessor, string
6060

6161
private void PropertyChanged(object? sender, PropertyChangedEventArgs e)
6262
{
63-
if (_isDisposed) throw new InvalidOperationException();
6463
if (e.PropertyName != _propertyName && !string.IsNullOrEmpty(e.PropertyName)) return;
64+
if (_isDisposed) throw new InvalidOperationException();
6565

6666
try
6767
{
@@ -80,6 +80,7 @@ public void Dispose()
8080
if (_isDisposed) return;
8181

8282
_isDisposed = true;
83+
_subject.PropertyChanged -= PropertyChanged;
8384
if (_onError is false)
8485
{
8586
try
@@ -92,7 +93,6 @@ public void Dispose()
9293
}
9394
}
9495

95-
_subject.PropertyChanged -= PropertyChanged;
9696
_subject = default!;
9797
_observer = null!;
9898
_accessor = null!;

0 commit comments

Comments
 (0)