Closed pkrysztofiak closed 6 years ago
From my experience, you should avoid mixing bidirectional bindings and Rx. It just gets messy and I've found them to behave strangely. That is an interesting observation though.
Can you pinpoint what would cause the issue? I'll go ahead and see if I can get input from some JavaFX folks as well. I'm a bit busy nowadays and having a hard enough time getting the JavaFX 11 support version out.
Can you pinpoint what would cause the issue?
Issue is caused by weak references on which JavaFx bidirectional bind is built on. Sooner or later the same behaviour would occur without using Rx. Using Rx accelerated the symptom by getting garbage collector into the play earlier. The solution is to assign property1, property2 to fields. It's documented in JavaFx so it has got nothing to do with Rx and was just my mistake. For now on everything with bidirectional bind and Rx works just fine.
Interesting nonetheless though. I'll go ahead and close and please let me know if anything else pops up, even if it's interesting behaviors.
EDIT Rx works fine. Described issue is caused by weak refernces. I wanted to bind two properties and listen for changes on both, using RxJavaFx. What I expected was - bind two properties, write to only one of them and listen for changes on both. It turned out it worked as I expected only using pure fx. Using RxJavaFx (please uncomment lines) causes firing change event only on directly updated property (even fx listener stopped to work). Another strange thing is that at first everything seems to work perfectly ("wow" line).