Mihai,

I'd love to add this to the 4.14.1 release. Do you think it is stable
enough for inclusion?

EdB



On Tue, Mar 10, 2015 at 5:43 PM,  <mih...@apache.org> wrote:
> FLEX-34778
> CAUSE: When a node is opened, HierarchicalCollectionView starts to listen to 
> changes to its children collection. And when it's closed, it doesn't stop 
> listening to these CollectionEvents. So when a closed node's child is 
> replaced, nestedCollectionChangeHandler is triggered, even if the node itself 
> is closed. Part of nestedCollectionChangeHandler's function is to dispatch a 
> REMOVE CollectionEvent for all the nodes which were removed by the 
> replacement (which is, all the descendants of the replaced - but closed! - 
> node). Then, since the node that's being replaced is not accessible anymore 
> (because its parent was closed), it's not added to convertedEvent.items. But 
> the next lines assume that the replaced node will be in that array without 
> mistake. Otherwise (as it happens in this bus) it goes into an infinite loop 
> trying to find it.
>
> SOLUTION: instead of looking for the node with an (indefinitely) incrementing 
> index, we're now using Array.indexOf() to locate the node and remove it if 
> it's found.
>
>
> Project: http://git-wip-us.apache.org/repos/asf/flex-sdk/repo
> Commit: http://git-wip-us.apache.org/repos/asf/flex-sdk/commit/32f39500
> Tree: http://git-wip-us.apache.org/repos/asf/flex-sdk/tree/32f39500
> Diff: http://git-wip-us.apache.org/repos/asf/flex-sdk/diff/32f39500
>
> Branch: refs/heads/develop
> Commit: 32f39500d34d05c14282cdafcef7ae494783df85
> Parents: ab0943c
> Author: Mihai Chira <mih...@apache.org>
> Authored: Tue Mar 10 13:00:10 2015 +0100
> Committer: Mihai Chira <mih...@apache.org>
> Committed: Tue Mar 10 13:00:10 2015 +0100
>
> ----------------------------------------------------------------------
>  .../src/mx/collections/HierarchicalCollectionView.as | 15 ++++++++-------
>  1 file changed, 8 insertions(+), 7 deletions(-)
> ----------------------------------------------------------------------
>
>
> http://git-wip-us.apache.org/repos/asf/flex-sdk/blob/32f39500/frameworks/projects/advancedgrids/src/mx/collections/HierarchicalCollectionView.as
> ----------------------------------------------------------------------
> diff --git 
> a/frameworks/projects/advancedgrids/src/mx/collections/HierarchicalCollectionView.as
>  
> b/frameworks/projects/advancedgrids/src/mx/collections/HierarchicalCollectionView.as
> index 6d4901c..d752e8e 100644
> --- 
> a/frameworks/projects/advancedgrids/src/mx/collections/HierarchicalCollectionView.as
> +++ 
> b/frameworks/projects/advancedgrids/src/mx/collections/HierarchicalCollectionView.as
> @@ -1152,7 +1152,7 @@ public class HierarchicalCollectionView extends 
> EventDispatcher
>      private function internalRefresh(dispatch:Boolean):Boolean
>      {
>          var obj:Object;
> -        var coll:ICollectionView
> +        var coll:ICollectionView;
>          var needUpdate:Boolean = false;
>
>          // apply filter function to all the collections including the child 
> collections
> @@ -1531,9 +1531,9 @@ public class HierarchicalCollectionView extends 
> EventDispatcher
>                  for (i = 0; i < n; i++)
>                  {
>                      node = ce.items[i].oldValue;
> -                    while (convertedEvent.items[j] != node)
> -                        j++;
> -                    convertedEvent.items.splice(j, 1);
> +                    var replacedNodePosition:int = 
> convertedEvent.items.indexOf(node);
> +                    if(replacedNodePosition != -1)
> +                        convertedEvent.items.splice(replacedNodePosition, 1);
>                  }
>                  if (convertedEvent.items.length)
>                  {
> @@ -1654,9 +1654,10 @@ public class HierarchicalCollectionView extends 
> EventDispatcher
>                      changingNode = ce.items[i].oldValue;
>                      if (changingNode is XML)
>                          stopTrackUpdates(changingNode);
> -                    while (convertedEvent.items[j] != changingNode)
> -                        j++;
> -                    convertedEvent.items.splice(j, 1);
> +
> +                    var replacedNodePosition:int = 
> convertedEvent.items.indexOf(changingNode);
> +                    if(replacedNodePosition != -1)
> +                        convertedEvent.items.splice(replacedNodePosition, 1);
>                  }
>                  if (convertedEvent.items.length)
>                  {
>



-- 
Ix Multimedia Software

Jan Luykenstraat 27
3521 VB Utrecht

T. 06-51952295
I. www.ixsoftware.nl

Reply via email to