Ticket #1836 (closed defect: fixed)

Opened 21 months ago

Last modified 8 months ago

Menu: not fully destroyed (target nodes still bound)

Reported by: guest Owned by: bill
Priority: normal Milestone: 1.1
Component: Dijit Version: 0.4
Severity: normal Keywords: Menu2 PopupMenu2
Cc:

Description

PopupMenu?2 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

Changed 21 months ago by bill

  • owner changed from bill to liucougar
  • milestone set to 0.5

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.

Changed 14 months ago by bill

  • owner changed from liucougar to bill
  • summary changed from PopupMenu2.destroy() -- not fully destroyed (target nodes still bound) to Menu: not fully destroyed (target nodes still bound)
  • component changed from Widgets to Dijit
  • milestone changed from 0.9 to 1.0

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

Changed 12 months ago by bill

  • milestone changed from 1.0 to 1.1

Changed 8 months ago by bill

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

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

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