Cysharp / R3

The new future of dotnet/reactive and UniRx.
MIT License
2.32k stars 103 forks source link

Unexpected behavior 2 in ReactiveProperty #167

Closed kimk-s closed 8 months ago

kimk-s commented 8 months ago

Thanks for your library.

This only works in 1.1.8 It doesn't seem to work in 1.1.7 and 1.1.9

var p1 = new ReactiveProperty<int>();
p1.Skip(1).Subscribe(x => Debug.Log("[P1]" + x));

var d1 = p1.Skip(1).Subscribe(x => Debug.Log("[P2]" + x));
var d2 = p1.Skip(1).Subscribe(x => Debug.Log("[P2]" + x));
d1.Dispose();
d2.Dispose();

p1.Skip(1).Subscribe(x => Debug.Log("[P3]" + x)); // P3 is not raised

p1.Value = 1;
p1.Value = 2;

public static class Debug
{
    public static void Log(string x)
    {
        Console.WriteLine(x);
    }
}
neuecc commented 8 months ago

thanks! I'll investigate soon.

neuecc commented 8 months ago

I've released v1.1.10. I apologize for the multiple issues, and thank you very much! The ad-hoc fixes were not good. I have replaced it with a completely new implementation that includes a fundamental review and improvements to thread safety. I have also added more tests. Your example has been included in the unit test cases.