Opened 15 years ago

Closed 15 years ago

Last modified 15 years ago

#2393 closed defect (fixed)

topWidgets not updated when dojo.widget.manager.remove called

Reported by: Michael Schall Owned by: alex
Priority: high Milestone:
Component: Widgets Version: 0.4.1
Keywords: Cc:
Blocked By: Blocking:


The topWidgets dictionary is not being updated when a widget is removed by calling dojo.widget.manager.remove. This will probably cause issues in other areas, but my specific case:

This has serious issues with the way that resizing works. If I destroy (widget.destroy(), code in widget/Widget.js) a widget. The widget is removed by a call to dojo.widget.manager.removeById. Later calls to dojo.widget.manager.onWindowResized which loops the top widgets calling checkSize fail. The dom node in _isResized in HtmlWidget? is null causing a trapped error which stops the resizing for the rest of the widgets on the page with no error message why. That widget should not even be around to be resized.

I tracked it down to the above issue with a simple fix. Check to see if the id is in the topWidgets dictionary and remove.

	this.remove = function(widgetIndex){
			var tw = this.widgets[widgetIndex].widgetId;
			if (this.topWidgets[tw]) {
				delete this.topWidgets[tw];
			delete this.widgetIds[tw];
			this.widgets.splice(widgetIndex, 1);

If the widget is to be removed, we should be clearing all references to that widget. This seems like a big issue that would be nice to have in the 0.4.2 release.

Attachments (1)

CleanTopWidgets.patch (483 bytes) - added by schall 15 years ago.
Patch for fix

Download all attachments as: .zip

Change History (6)

comment:1 Changed 15 years ago by dylan

Milestone: 0.9
Priority: highnormal

Changed 15 years ago by schall

Attachment: CleanTopWidgets.patch added

Patch for fix

comment:2 Changed 15 years ago by alex

Owner: changed from bill to alex
Status: newassigned

comment:3 Changed 15 years ago by alex

Resolution: fixed
Status: assignedclosed

(In [7316]) fixes #2393

comment:4 Changed 15 years ago by alex

thanks for the good report and fix, Mike

comment:5 Changed 15 years ago by (none)

Milestone: 0.4.2

Milestone 0.4.2 deleted

Note: See TracTickets for help on using tickets.