Uploaded image for project: 'Apache Flex'
  1. Apache Flex
  2. FLEX-17045

removeItemAt (and others) don't work when collection has duplicate object references

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Open
    • Major
    • Resolution: Unresolved
    • Adobe Flex SDK 3.2 (Release)
    • None
    • Collections
    • None
    • Affected OS(s): All OS Platforms
      Affected OS(s): All OS Platforms
      Browser: Other (specify version)
      Language Found: English

    Description

      I will attach some code which exhibits the problem.

      The problem is essentially this. When working with a filtered collection, the index that is provided to removeItemAt() or setItemAt() is disregarded in some degree. It is used to identify the object in the filtered array, then an unintelligent linear search is done in the unfiltered collection, starting at the first item, for the specified item. When the collection contains multiple references to the same object, the object at the incorrect location may then located, instead of the actual item; this happens whenever attempting to delete a non-unique item for which there is an item earlier within the collection than the index specified to removeItemAt(). In the case of remove, the first matching object found is removed. Even if not at the index specified.

      The way I see it, there are a few problems:

      1) It assumes that I won't have multiple references to the same object
      2) It's linear search through the unfiltered list is unintelligent. At minimum, it should start the search at the location in the filtered list. The list having been filtered, there's no possible way that the object could have a lower index than the index provided to setItemAt/removeitemAt.
      3) Doing an O search on a potentially very large list is bad for performance

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              adobejira Adobe JIRA
              Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

                Created:
                Updated: