I don’t see any problem in this code, it should work I think. I don’t know when the object is supposed to be frozen though
a
Andy Victors
05/23/2019, 11:03 AM
Apparently the object becomes frozen after addObserver() line. Could someone from Kotlin authors explain what mechanism is taking place here?
Andy Victors
05/23/2019, 11:04 AM
Wait, sorry. I know the answer - in addObserver() current objet is added to the frozenCopyOnWriteList<> from Stately library. I have already asked lib author to explain this behaviour.
b
basher
05/23/2019, 12:48 PM
You can call ensureNeverFrozen() on an object you expect to never be frozen, and then you’ll get an exception with a trace that shows where it’s being frozen