PDA

View Full Version : Ext.util.TaskRunner : stopAll stops nothing at all!...



iBeb
28 Jun 2010, 4:47 AM
I've recently noticed that after launching my app, and before opening windows, grids and so on, my cpu was very low. Perfect.
Then when I open a window (especially with a FormPanel on it) , CPU level increases. That's normal.
But when I close everything, the cpu level doesn't change.
So I tried to figure out why. And here what I found: the Ext.FormPanel stopMonitoring doesn't stop the 'bindHandler' method called every 200ms.
Here are the changes I've made to understand:

bindHandler : function(){
console.log('bindHandler');
var valid = true;
this.form.items.each(function(f){
if(!f.isValid(true)){
valid = false;
return false;
}
});
and
,stopMonitoring : function(){
if(this.validTask){
console.log('stopMinitoring');
this.validTask.stopAll();
this.validTask = null;
}
}
And my console logs:

bindHandler
bindHandler
bindHandler
[...]
bindHandler
bindHandler
stopMonitoring
bindHandler
bindHandler
bindHandler
[..]
bindHandler
bindHandler
bindHandler
bindHandler
bindHandler
bindHandler
bindHandler
bindHandler

It means the task is still running!!!

Animal
28 Jun 2010, 4:56 AM
Works for me.



myFormPanel.validTask.stopAll();


And it stops.

What Ext version?

iBeb
28 Jun 2010, 5:06 AM
My mistake.
I had two forms, and two tasks.
So I've changed my script and put this for Ext.FormPanel

,destroy : function(){
console.log('FormPanel.destroy');
this.stopMonitoring();
Ext.FormPanel.superclass.destroy.call(this);
}
But the thing is: it's never called!
When the window is closed (not hidden), the form is not destroyed...

evant
28 Jun 2010, 5:08 AM
Moving this to help, you haven't really provided enough information.

Animal
28 Jun 2010, 5:41 AM
That's a listener right, not a direct config? 8-|

iBeb
28 Jun 2010, 7:07 AM
Actually, I found the problem.
The formPanel is on a drawer (http://tdg-i.com/54/extuxpluginswindowdrawers-10-beta-1-released).
A drawer is basically a window.
The drawer is bound to the master window, but on the original script, there's no listener to the master window close event.
So when the master window is closed, the drawer is not destroyed.
I've added this :

this.win.on('close',this.onWindowClose,this);
and

,onWindowClose:function(){
this.close();
}
And everything's fine.

Animal
28 Jun 2010, 7:23 AM
Post a bug report to the author.

That's a plugin for the Window class isn't it?

It should hook into the Window's destroy event and destroy itself. You should not have to do that.