PDA

View Full Version : When a app.ViewController is destroy events in app.Controller stop behing trapped



BBeauchemin
24 Apr 2014, 10:06 AM
https://fiddle.sencha.com/#fiddle/532

Has showed in the fiddle, the first time we click on the button the event is trapped in the 'Ext.app.Controller'.
The second time, the event is not trapped because we closed a windows that has a Ext.app.ViewController.

If the windows does not have a 'Ext.app.ViewController' this would not reproduce.

I guess this issue is part of the cleaning code of the ViewController.

Chris Thornhill
24 Apr 2014, 10:53 AM
I just noticed this as well. In my case, EventDomain.unlisten() is attempting to use a controller id of null, which presumably does bad things. I'd guess ensureId isn't being called by anything. The workaround is to add an id to the ViewController:


config: {
id: 'something';
}

mitchellsimoens
24 Apr 2014, 11:08 AM
In Ext JS 5 you should use control or listen as a config not as a method within init. I've updated your fiddle and it is now working better.

LesJ
24 Apr 2014, 11:21 AM
I just noticed this as well. In my case, EventDomain.unlisten() is attempting to use a controller id of null, which presumably does bad things. I'd guess ensureId isn't being called by anything. The workaround is to add an id to the ViewController:


config: {
id: 'something';
}

Using id on the ViewController might be not reliable since there might be many instances of the same view controller.

LesJ
24 Apr 2014, 11:30 AM
In Ext JS 5 you should use control or listen as a config not as a method within init. I've updated your fiddle and it is now working better.

I prefer the config option, but the inline doc (http://docs-origin.sencha.com/extjs/5.0.0/apidocs/#!/api/Ext.app.Controller)still uses the this.control method.

mitchellsimoens
24 Apr 2014, 11:31 AM
I prefer the config option, but the inline doc (http://docs-origin.sencha.com/extjs/5.0.0/apidocs/#!/api/Ext.app.Controller)still uses the this.control method.

Yup, got a jira issue open to update the documentation.

Chris Thornhill
24 Apr 2014, 11:59 AM
It seems the fiddle still demonstrates the bug if you remove:

closeAction: 'hide',

so that the ViewController is actually destroyed.

mitchellsimoens
24 Apr 2014, 12:14 PM
Check out this fiddle since you changed what I changed: https://fiddle.sencha.com/#fiddle/5ba

bone
24 Apr 2014, 1:31 PM
I was most likely the culprit in changing what you changed.

Seems I hit Cmd+S by reflex a couple of times.

themightychris
12 Aug 2014, 3:18 PM
I thought I had encountered this bug too, but there seems to be an unrelated one specifically in 5.0.1 that using using control in config doesn't fix: http://www.sencha.com/forum/showthread.php?290043-5.0.1-destroying-a-view-with-ViewController-attached-disables-listen-..-handlers