Opened 15 years ago

Closed 15 years ago

Last modified 11 years ago

#4902 closed defect (fixed)

DropDownButton/ComboButton/nested Menus: destroyRecursive() leaves orphaned sub-menus

Reported by: bill Owned by:
Priority: high Milestone: 1.1
Component: Dijit - Form Version: 0.9
Keywords: Cc:
Blocked By: Blocking:

Description (last modified by bill)

For ComboButton? or anything with a nested popup, the popup gets moved as a direct child of document.body to make positioning easier, but that means that ComboButton?.destroyRecursive() won't destroy the popup, and similarly Menu.destroy won't destroy any submenus.

This is only an issue when dynamically creating and destroying objects.

Change History (8)

comment:1 Changed 15 years ago by bill

Description: modified (diff)
Summary: DropDowb/ComboButton, nested Menus: memory leak on destroy recursiveDropDownButton/ComboButton/nested Menus: memory leak on destroyRecursive()

comment:2 Changed 15 years ago by Sam Foster

Summary: DropDownButton/ComboButton/nested Menus: memory leak on destroyRecursive()DropDownButton/ComboButton/nested Menus: destroyRecursive() leaves orphaned sub-menus

getDescendants returns only the menu items, not the sub-menus, so destroyRecursive never gets an opportunity to remove those.

Is this really unique to popup-menus? if so perhaps Menu should supply its own getDescendants function to include these sibling sub-menu nodes which need to be considered descendants.

Bear in mind a sub-menu may be shared by other menus? (at least this was the case in 0.4) - not sure how to manage that. There's a parent/child relationship present in the popups, but its potentially dynamic? For sure though, if you create declaratively and nest a sub-menu, the expectation is that destroyRecursive should remove the lot.

Moving this to 1.0.1 (please?)

comment:3 Changed 15 years ago by bill


Sub menus can no longer be shared by other menus.

This issue only applies to dynamically created/destroyed menus, which is in an unusual case, pluswhich I think there's a workaround, something like:

dojo.connect(dijit.PopupMenuItem.prototype, "destroy", function(){ this.popup.destroy(); });
dojo.connect(dijit.form.DropDownButton.prototype, "destroy", function(){ this.dropDown.destroy(); });

So I'm not going to fix for 1.0.1, but will do for 1.1.

comment:4 Changed 15 years ago by bill

Same root cause as #3300.

comment:5 Changed 15 years ago by bill

(In [11688]) Fix destruction issues with Menu. Fixes #1836. Refs #4902 (fixes it for Menu)

comment:6 Changed 15 years ago by bill

Resolution: fixed
Status: newclosed

(In [11690]) Fix issues with destruction of drop down menu of a DropDownButton?. Fixes #4902.

comment:7 Changed 15 years ago by bill

(In [11735]) Fix regression in [11688] that was causing double destroy calls on same widget. Fixes #5326, Refs #1836, #4902.

comment:8 Changed 11 years ago by bill

Component: DijitDijit - Form
Note: See TracTickets for help on using tickets.