PDA

View Full Version : What happens to listner and callbacks if panel is destroyed?



Wolfgang
27 Dec 2006, 1:51 AM
Hello,

given i use a contentpanel with a couple of event listners and user defined events. What happens if i remove such a contentpanel and do not reload the page, will this create memory leaks and the like, or will all objects and registered functions be destroyed with the removal of the panel?

Regards

Wolfgang

jack.slocum
27 Dec 2006, 5:29 AM
If preservePanels is not true on the region, the panel will be destroyed. You may want to override destroy on the ContentPanel if you need special destruction operations.

Wolfgang
27 Dec 2006, 6:11 AM
And what happens to listeners, callbacks etc. that had been used/defined within the panel, after the panel is destroyed. Will they cause memory leaks/other kind of problems, or will the deletion of the panel clean them up automatically?

tryanDLS
27 Dec 2006, 9:19 AM
Looking at the destroy code, it calls removeAllListeners, which looks to remove the events from the dom element. You could step thru this code to convince yourself, but I believe one of the blog posts talked about this being part of the design to eliminate leaks.