From 2008478378fc4028f99ae05cc0f8ca8d0afbc5cb Mon Sep 17 00:00:00 2001 From: John Colvin Date: Sat, 18 Feb 2023 13:08:00 -0500 Subject: [PATCH] fix (pre-emptive): Fix typo (check val == 1, not 0) Bugs (fixed): The IObservable.StopAfter ext fn never actually stops the sequence (even after the timeout expires). --- src/client/spark_core/utils/ObservableExtensions.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/client/spark_core/utils/ObservableExtensions.cs b/src/client/spark_core/utils/ObservableExtensions.cs index c3a8e3334..b151347b8 100644 --- a/src/client/spark_core/utils/ObservableExtensions.cs +++ b/src/client/spark_core/utils/ObservableExtensions.cs @@ -324,14 +324,14 @@ namespace System.Reactive.Linq { } void on_complete() { - if (Interlocked.Increment(ref state) == 0) { + if (Interlocked.Increment(ref state) == 1) { o.OnCompleted(); Disposable.dispose(ref sub); } } void dispose() { - if (Interlocked.Increment(ref state) == 0) { + if (Interlocked.Increment(ref state) == 1) { Disposable.dispose(ref sub); } }