Opened 13 years ago

Closed 12 years ago

Last modified 12 years ago

#1836 closed defect (fixed)

Menu: not fully destroyed (target nodes still bound)

Reported by: guest Owned by: bill
Priority: high Milestone: 1.1
Component: Dijit Version: 0.4
Keywords: Menu2 PopupMenu2 Cc:
Blocked By: Blocking:

Description

PopupMenu2 initializers bind to the target nodes, but that is currently not undone when destroying the widget (this breaks any future menu functionality on those nodes).

The passive workaround is to unbind the target nodes before destroying:

    var menu = dojo.widget.byId('mymenu');
    dojo.lang.forEach(menu.targetNodeIds, menu.unBindDomNode, menu);
    menu.destroy();

I'm not sure what the proper override is in Menu2.js (Widget::cleanUp, Widget::uninitialize, Widget::destroyRendering ?), but a patch might look like this:

uninitialize: function(){
 dojo.lang.forEach(this.targetNodeIds, this.unBindDomNode, this);
}

Change History (5)

comment:1 Changed 13 years ago by bill

Milestone: 0.5
Owner: changed from bill to liucougar

Yes, we need to cleanup the bindings to all nodes in this.targetNodeIds[], as well as any nodes that were bound to manual calls to bindDomNode(), and also just the binding to document.body itself (for window-level context menu).

I wish there were a way to delete all events that connect to a certain function.

comment:2 Changed 12 years ago by bill

Component: WidgetsDijit
Milestone: 0.91.0
Owner: changed from liucougar to bill
Summary: PopupMenu2.destroy() -- not fully destroyed (target nodes still bound)Menu: not fully destroyed (target nodes still bound)

Hmm, I guess this is still an issue with the Dijit Menu.

comment:3 Changed 12 years ago by bill

Milestone: 1.01.1

comment:4 Changed 12 years ago by bill

Resolution: fixed
Status: newclosed

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

comment:5 Changed 12 years ago by bill

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

Note: See TracTickets for help on using tickets.