You found a bug! We've classified it as EXTJSIII-100 . We encourage you to continue the discussion and to find an acceptable workaround while we work on a permanent fix.
  1. #1
    Ext JS Premium Member
    Join Date
    Dec 2010
    Posts
    2
    Vote Rating
    0
    cscomkl is on a distinguished road

      0  

    Default Ext.EventManager.removeFromSpecialCache() iterating past end of array error

    Ext.EventManager.removeFromSpecialCache() iterating past end of array error


    Tested version: Ext JS 3.4.0 and 3.4.1
    Browsers: All

    Code:
            removeFromSpecialCache: function(o) {
                var i = 0,
                    len = specialElCache.length;
                    
                for (; i < len; ++i) {
                    if (specialElCache[i].el == o) {
                        specialElCache.splice(i, 1); 
                    }
                }
            },
    When "specialElCache.splice(i, 1);" removes an item from the "specialElCache" array, array length is no longer "len" and causes "TypeError: specialElCache[i] is undefined" (Firefox) when iterating past the end of the array.

    I am now using temporary fix:

    Code:
            removeFromSpecialCache: function(o) {
                var i = 0,
                    len = specialElCache.length,
                    a=[];
                    
                for (; i < len; ++i) {
                    if (specialElCache[i].el != o) {
                        a.push(specialElCache[i]);
                    }
                }
                specialElCache=a;
            },

  2. #2
    Sencha - Senior Forum Manager mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    St. Louis, MO
    Posts
    33,624
    Vote Rating
    435
    mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of

      0  

    Default


    Thanks for the report! I have opened a bug in our bug tracker.

  3. #3
    Sencha User
    Join Date
    May 2009
    Posts
    16
    Vote Rating
    0
    padraig is on a distinguished road

      0  

    Default


    Any update on this bug? I'm getting it when I call destroy() on an Ext.Window component.
    Padraig.

  4. #4
    Sencha User
    Join Date
    Nov 2010
    Posts
    5
    Vote Rating
    0
    Sergeith is on a distinguished road

      0  

    Default


    I have the same bug on FireFox (Extjs 3.4.1)

  5. #5
    Sencha User
    Join Date
    May 2009
    Posts
    16
    Vote Rating
    0
    padraig is on a distinguished road

      0  

    Default


    For me it happens when I've got 2 htmleditor components on the window and I call destroy() on the window. With only 1 htmleditor on the window, the error does not occur.

    It happens on the 2nd call to
    Code:
    Ext.EventManager.removeFromSpecialCache(doc);
    in the beforeDestroy() function of Ext.form.HtmlEditor()
    Padraig.