Opened 12 years ago

Closed 12 years ago

#5118 closed defect (fixed)

Dialog: hide() followed quickly by destroy() throws error

Reported by: guest Owned by:
Priority: high Milestone:
Component: Dijit Version: 1.0
Keywords: dijit, dijit.Dialog, Dialog, destroy, destroyRecursive, hide Cc: tk
Blocked By: Blocking:

Description (last modified by bill)

Calling dijit.Dialog.hide(), and then immediately calling dijit.Dialog.destroy() or dijit.Dialog.destroyRecursive() on a Dialog will throw an error "this.domNode has no properties". Interestingly, it cannot be caught by wrapping the call in a try/catch.

This is rather annoying since .hide() only hides the dialog, which makes it hard to do "throwaway" dialogs -- something that you create, use once, and destroy.

Attachments (2)

test_Dialog_bug.html (1.3 KB) - added by guest 12 years ago.
Page that demonstrates the defect.
test_Dialog_bug-1.html (1.3 KB) - added by bill 12 years ago.
add hide() to test case; otherwise problem doesn't reproduce

Download all attachments as: .zip

Change History (9)

Changed 12 years ago by guest

Attachment: test_Dialog_bug.html added

Page that demonstrates the defect.

comment:1 Changed 12 years ago by bill

Tried the test, works for me with no errors. I tried on FF2/mac. What browser were you using? See http://dojotoolkit.org/~bill/svn/test_Dialog_bug.html

comment:2 Changed 12 years ago by guest

FF 2.0.0.9, WinXP. Also occurs on MSIE7.0, but, strangely, not every time.

comment:3 in reply to:  2 Changed 12 years ago by guest

I tried it through the link you supplied, and... no error. The same file on my local system does produce it. Bizarre, I'll look into it further.

comment:4 Changed 12 years ago by guest

I was watching this bug (I entered a similar one, #5141). It works for me with no errors on FF 2.0.0.8/Mac, but if I add "widg.hide();" before "widg.destroyRecursive();" it produces an error.

comment:5 Changed 12 years ago by tk

Cc: tk added

This is a race condition, when calling dlg.hide() you have to allow time for the underLay widget to be destroyed.... I found that adding a 500ms timeout between hide and destroy() works....

comment:6 Changed 12 years ago by bill

Description: modified (diff)
Summary: dijit.Dialog.destroy() throws errorDialog: hide() followed quickly by destroy() throws error

ah thanks for finding that... updating bug title/description

Changed 12 years ago by bill

Attachment: test_Dialog_bug-1.html added

add hide() to test case; otherwise problem doesn't reproduce

comment:7 Changed 12 years ago by bill

Resolution: fixed
Status: newclosed

(In [11525]) Fixes #5118: stop animation before destroying widget, or else will get references to deleted this.domNode

Note: See TracTickets for help on using tickets.