PDA

View Full Version : [CLOSED] Component - Base.destroy() is not called



LesJ
29 Apr 2014, 12:05 PM
I noticed that the protected Base.destroy method is not called by many classes.

I'm not sure if this is overlooked or intentional. See the Ext.Component as an example.

Ext.Base = (function(flexSetter) {
...
/**
* @protected
*/
destroy: function() {
this.destroy = Ext.emptyFn;
this.isDestroyed = true;


if (this.hasOwnProperty('$links')) {
this.unlink.apply(this, Ext.Object.getKeys(this.$links));
this.$links = null;
}
}
});
...
********************************************
Ext.define('Ext.Component', {
...
destroy: function() {
...
if (!me.isDestroyed) { // <--- this check is not needed b/c destroy is reset to Ext.emptyFn
if (!me.hasListeners.beforedestroy || me.fireEvent('beforedestroy', me) !== false) {
...
me.destroying = false;
me.isDestroyed = true; // <--- this is set in Base.destroy()
}
}
me.callParent() // <--- missing?
},
...

mitchellsimoens
1 May 2014, 4:33 AM
Thanks for the report! I have opened a bug in our bug tracker.

LesJ
1 May 2014, 5:27 AM
Please explain the purpose of the unlinking code in the Base.destroy method, thx.

Adding an inline comment would help.