Fix reference counting wrt reference collections
When assigning a set with objects in it to a ReferenceCollection attribute, those objects are registered conditionally. When adding objects to a set, or removing objects from one, registrations are updated unconditionally. See the bugfix-refcount branch, it has regression tests as well as a list of ideas for fixing things.
First of all, find out about the state of the affair (behaviour, existing branches) nowadays. If this is still a problem, it is probably not one that occurs in any projects we're hearing of (which may be a rather wrong assumption, though) but if it occurs it has the potential to cause data loss.