Ticket #5118 (closed defect: fixed)

Opened 13 months ago

Last modified 12 months ago

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

Reported by: guest Owned by:
Priority: normal Milestone:
Component: Dijit Version: 1.0
Severity: normal Keywords: dijit, dijit.Dialog, Dialog, destroy, destroyRecursive, hide
Cc: tk

Description (last modified by bill) (diff)

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

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

Change History

Changed 13 months ago by guest

Page that demonstrates the defect.

  Changed 13 months 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

follow-up: ↓ 3   Changed 13 months ago by guest

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

in reply to: ↑ 2   Changed 13 months 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.

  Changed 13 months 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.

  Changed 12 months 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....

  Changed 12 months ago by bill

  • description modified (diff)
  • summary changed from dijit.Dialog.destroy() throws error to Dialog: hide() followed quickly by destroy() throws error

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

Changed 12 months ago by bill

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

  Changed 12 months ago by bill

  • status changed from new to closed
  • resolution set to fixed

(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.