Opened 12 years ago

Closed 12 years ago

Last modified 12 years ago

#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: frank.fortson@…
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)

test_DialogFF.html (18.4 KB) - added by guest 12 years ago.
Dialog, this._fadeIn/._fadeOut is null or not an object

Download all attachments as: .zip

Change History (3)

Changed 12 years ago by guest

Attachment: test_DialogFF.html added

Dialog, this._fadeIn/._fadeOut is null or not an object

comment:1 Changed 12 years ago by bill

Resolution: fixed
Status: newclosed

(In [11727]) Fixes #5282: referencing variables that may not have been initialized (because the dialog was nevefr displayed)

comment:2 Changed 12 years ago by Adam Peller

Milestone: 1.0.21.1

it appears this problem was introduced after the 1.0 release

Note: See TracTickets for help on using tickets.