View Full Version : refs keeps object in cache after they have been destroyed

24 Dec 2011, 8:55 PM
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)

24 Dec 2011, 10:03 PM
I see this code in 4.0.7:

if (cached) {
cached.on('beforedestroy', function() {
me.refCache[ref] = null;


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

25 Dec 2011, 4:30 AM
I were using 4.0.1a, looks like it wasn't there that part of code, updating extjs fixed the problem.

Thanks a lot!