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, 3.4.1, 3.4.1.1 (Update May 2013)
    Browsers: All

    Code:
            //Ext 3.4.1.1, ext-all-debug.js, line 5357
            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:

    Update May 2013: The previous fix solved the problem in IE9 (the only version of IE I've tested this time around) and caused another - some elements no longer get automatically destroyed and stayed visible. This is not a detailed problem description because I don't have the time to look into it. My solution is simply to bypass the function entirely if browser is IE. Works great so far. New fix is below:

    Code:
            removeFromSpecialCache: function(o) {
                if(Ext.isIE){return}
    
                var i = 0,
                    len = specialElCache.length;
    
                for (; i < len; ++i) {
                    if (specialElCache[i].el == o) {
                        specialElCache.splice(i, 1);
                        len--;
                    }
                }
            },

  2. #2
    Sencha - Senior Forum Manager mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    36,756
    Vote Rating
    828
    mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute

      0  

    Default


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

  3. #3
    Sencha User
    Join Date
    May 2009
    Posts
    18
    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
    7
    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
    18
    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.

  6. #6
    Sencha User
    Join Date
    Jun 2013
    Posts
    2
    Vote Rating
    0
    richwastaken is on a distinguished road

      0  

    Default


    Also experienced this defect on Extjs 3.4.1.1. but using the following for loop

    Code:
    for (; i < len; ) {
        if (specialElCache[i].el == o) {
            specialElCache.splice(i, 1);
            len--;
        } else {
            i++;
        }
    }
    because splice removes the element and moves the remaining elements down one index value. A four element array would look like 0,1,2,3 after splicing element with index 2, the array looks like 0,1,2.

    Developer @ Starfish Retention Solutions
    Software Developer
    Starfish Retention Solutions

  7. #7
    Touch Premium Member
    Join Date
    Jan 2008
    Location
    Germany
    Posts
    515
    Vote Rating
    0
    Stefan B is on a distinguished road

      0  

    Default


    Thanks richwastaken, your solution seems to be working fine.
    Anybody got a clue how to put this into an override file without touching the library code itself? Doesn't seem too easy since ExtEventManager is a singleton ...

  8. #8
    Ext JS Premium Member
    Join Date
    Mar 2011
    Location
    DC
    Posts
    5
    Vote Rating
    0
    amitdaya is on a distinguished road

      0  

    Default


    Depending the order your JS files are loaded, you could create a new file that is a copy of the Ext.EventManager but has the suggested fixes in it and then load it after the orginial Ext.EvertManager singleton has loaded, so it can override the original instance.

  9. #9
    Touch Premium Member
    Join Date
    Jan 2008
    Location
    Germany
    Posts
    515
    Vote Rating
    0
    Stefan B is on a distinguished road

      0  

    Default


    Yeah, but, while being part of the public interface, the function references a local variable in the constructor which is not available in the new context.

  10. #10
    Sencha User
    Join Date
    Oct 2011
    Location
    Minsk, Belarus
    Posts
    1
    Vote Rating
    0
    kozorezal is on a distinguished road

      0  

    Default


    Quote Originally Posted by Stefan B View Post
    Thanks richwastaken, your solution seems to be working fine.
    Anybody got a clue how to put this into an override file without touching the library code itself? Doesn't seem too easy since ExtEventManager is a singleton ...

    SpecialCache behaves like Set, according to the algorithm. We could simply wrap it into try catch statement, without any actions on catch.
    I used following override solution for this issue:

    Code:
        
        var f = Ext.EventManager.removeFromSpecialCache;
        Ext.EventManager.removeFromSpecialCache = function() {
            try {
                // f.apply is needed if interface and implementation 
                //of removeFromSpecialCache will be changed
                
                f.apply(Ext.EventManager, arguments);
            } catch (e) {
                // nothing to catch because specialCache is behaves like a set.
            }
        };

Turkiyenin en sevilen filmlerinin yer aldigi xnxx internet sitemiz olan ve porn sex tarzi bir site olan mobil porno izle sitemiz gercekten dillere destan bir durumda herkesin sevdigi bir site olarak tarihe gececege benziyor. Sitenin en belirgin ozelliklerinden birisi de Turkiyede gercekten kaliteli ve muntazam, duzenli porno izle siteleri olmamasidir. Bu yuzden iste. Ayrica en net goruntu kalitesine sahip adresinde yayinlanmaktadir. Mesela diğer sitelerimizden bahsedecek olursak, en iyi hd porno video arşivine sahip bir siteyiz. "The Best anal porn videos and slut anus, big asses movies set..." hd porno faketaxi