1. #1
    Sencha User Fire-Dragon-DoL's Avatar
    Join Date
    Dec 2011
    Posts
    141
    Answers
    9
    Vote Rating
    1
    Fire-Dragon-DoL is on a distinguished road

      0  

    Default Answered: refs keeps object in cache after they have been destroyed

    Answered: refs keeps object in cache after they have been destroyed


    I'm having a situation where a controller has a method hasWindow which simply checks if my ref called windowView (so the method getWindowView) is empty (Ext.isEmpty). However, even after pressing the CROSS button on the window and destroy event have been fired, the getWindowView still returns something that will result in a not Empty. This is obviusly giving me a lot of troubles, are there any way to fix this? (clearing cache for refs or something like this).

    Actually I solved by creating a field in my controller which points directly to the used view, so I totally skip refs and use it even for the check (and I obviusly set to null my field when required).

    Are there any way to keep using refs which I prefer? (maybe for syntax, dunno)

  2. I see this code in 4.0.7:

    Code:
    if (cached) {
        cached.on('beforedestroy', function() {
            me.refCache[ref] = null;
        });
    }
    http://docs.sencha.com/ext-js/4-0/so...app-Controller

    You might want to investigate with some breakpoints here because it looks like that should clear the cache for destroyed components.

  3. #2
    Sencha Premium Member skirtle's Avatar
    Join Date
    Oct 2010
    Location
    UK
    Posts
    3,604
    Answers
    543
    Vote Rating
    325
    skirtle has a brilliant future skirtle has a brilliant future skirtle has a brilliant future skirtle has a brilliant future skirtle has a brilliant future skirtle has a brilliant future skirtle has a brilliant future skirtle has a brilliant future skirtle has a brilliant future skirtle has a brilliant future skirtle has a brilliant future

      0  

    Default


    I see this code in 4.0.7:

    Code:
    if (cached) {
        cached.on('beforedestroy', function() {
            me.refCache[ref] = null;
        });
    }
    http://docs.sencha.com/ext-js/4-0/so...app-Controller

    You might want to investigate with some breakpoints here because it looks like that should clear the cache for destroyed components.

  4. #3
    Sencha User Fire-Dragon-DoL's Avatar
    Join Date
    Dec 2011
    Posts
    141
    Answers
    9
    Vote Rating
    1
    Fire-Dragon-DoL is on a distinguished road

      0  

    Default


    I were using 4.0.1a, looks like it wasn't there that part of code, updating extjs fixed the problem.

    Thanks a lot!

Thread Participants: 1