#5282 closed defect (fixed)
Dialog: uninitialize (destroy) can fail if dialog is never shown once [this._fadeIn is null or not an object]
Reported by: | guest | Owned by: | |
---|---|---|---|
Priority: | high | Milestone: | 1.1 |
Component: | Dijit | Version: | 1.0 |
Keywords: | dialog this._fadeIn this._fadeOut | Cc: | [email protected]… |
Blocked By: | Blocking: |
Description
When a dijit.Dialog is created/constructed, but never shown/initialized (this._setup), and the Dialog is destroyed, either directly or via a window.unload, and, if the page is complex enough to take some time to tear down, this error will be thrown:
Error: this._fadeIn (or ._fadeOut) is null or not an object.
Although the Dialog's hide and show methods make a test for prior initialization before proceeding, the uninitialize method does not.
This dojo Book page on Dialogs may be an example of this or a related problem. To see the problem, view it with IE7. Both FF2 and IE7 can demonstrate this problem, occasionally, but it is difficult to construct a small test case, so timing/page size may be a factor. Attached is a modified test_Dialog.html file where Firebug shows the error. The changes to the test file were to, in init(), create a dialog, not show it, and then destroy it. In more complex pages, you would not have to explicitly destroy the Dialog to see the problem on window.unload.
Nevertheless, it seems the check for prior initialization should be made in uninitialize to prevent attempts to reference a property of a null (never defined/set) variable.
uninitialize: function(){ if(this._alreadyInitialized){ //added this if condition line if(this._fadeIn.status() == "playing"){ this._fadeIn.stop(); } if(this._fadeOut.status() == "playing"){ this._fadeOut.stop(); } } //added this closing brace if(this._underlay){ this._underlay.destroy(); } },
Attachments (1)
Change History (3)
Changed 13 years ago by
Attachment: | test_DialogFF.html added |
---|
comment:1 Changed 13 years ago by
Resolution: | → fixed |
---|---|
Status: | new → closed |
comment:2 Changed 13 years ago by
Milestone: | 1.0.2 → 1.1 |
---|
it appears this problem was introduced after the 1.0 release
Dialog, this._fadeIn/._fadeOut is null or not an object