Clean up the logic for cleaning RelationCounterField instance states.
Review Request #9759 — Created March 7, 2018 and submitted — Latest diff uploaded
_reset_state()
is responsible for clearing out any state entries for a
given set of instance information, or for any instance states without an
active instance (one that was destroyed). The code wasn't super clear,
and a bit harder to debug.This change redoes that logic, splitting it into two pieces: The part
that cleans up a state dictionary, and the part that calls it for each
dictionary.
Unit tests pass.