sproutcore/sproutcore — pull request #791 by tim-evans (2012-06-01 15:10:37+00:00)
Title: Clean up item content observers on segmented views

When updating the segment content items, segmented views did not remove observers from the previous content. This caused old observers to hang around after the items should be removed from the segments. This occurred both when extra segments were destroyed as well as when content was shifted around within existing tabs. And, because 'removed' items remembered their old indices when the observers fired, they would sometimes re-insert themselves into their old segment.

To fix this, we remove observers from SC.Object items when we delete extra segments, and when we update the content we check to see if each old item will remain in the items list. If they will be removed, we clean up the observers before we update the segment.