ModalPanel: incomplete cleanup at destroy method
------------------------------------------------

                 Key: RF-6027
                 URL: https://jira.jboss.org/jira/browse/RF-6027
             Project: RichFaces
          Issue Type: Bug
    Affects Versions: 3.2.2
         Environment: IE7
            Reporter: Sergey Astakhov


Extracts from modalPanel.js:

show():
...
if (this.options.autosized) {
  this.observerSize =
    window.setInterval(this.correctShadowSize.bindAsEventListener(this), 500);
}
...

hide():
...
if (this.options.autosized) {
  window.clearInterval(this.observerSize);
}
...

You are setting up timer listener when ModalPanel is displayed, and clear it 
when hiding. All works fine when show() is paired with hide(), but there is 
exist a possibilities when region with panel is replaced by ajax response, then 
on panel is called only the destroy() method, but not hide(). In this case 
timer is rest in memory and cause flickering of shadow of panel if you try to 
display the panel (replaced by ajax) again (and may cause memory leaks).

As workaround I tried to include cleanup code in destroy() method:

---
ModalPanel.prototype.originalModalDestroy = ModalPanel.prototype.destroy;

ModalPanel.prototype.destroy = function(id, options)
{
  if( this.shown && this.options.autosized )
  {
    window.clearInterval(this.observerSize);
  }

  return this.originalModalDestroy(id, options);
};
---

After this change the problems seems to gone away. 


-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: 
https://jira.jboss.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        
_______________________________________________
richfaces-issues mailing list
[email protected]
https://lists.jboss.org/mailman/listinfo/richfaces-issues

Reply via email to