diff --git a/api/js/etemplate/Et2Widget/Et2Widget.ts b/api/js/etemplate/Et2Widget/Et2Widget.ts index 6c5cfaa1e3..a6bd1293a6 100644 --- a/api/js/etemplate/Et2Widget/Et2Widget.ts +++ b/api/js/etemplate/Et2Widget/Et2Widget.ts @@ -547,6 +547,21 @@ const Et2WidgetMixin = (superClass : T) => destroy() { // Not really needed, use the disconnectedCallback() and let the browser handle it + + // Call the destructor of all children so any legacy widgets get destroyed + for(let i = this.getChildren().length - 1; i >= 0; i--) + { + this.getChildren()[i].destroy(); + } + + // Free the array managers if they belong to this widget + for(let key in this._mgrs) + { + if(this._mgrs[key] && this._mgrs[key].owner == this) + { + delete this._mgrs[key]; + } + } } isInTree() : boolean diff --git a/api/js/etemplate/et2_widget_file.ts b/api/js/etemplate/et2_widget_file.ts index f35d3f52b5..0c7ffa7c64 100644 --- a/api/js/etemplate/et2_widget_file.ts +++ b/api/js/etemplate/et2_widget_file.ts @@ -298,7 +298,7 @@ export class et2_file extends et2_inputWidget let drop_target = widget && widget.getDOMNode() || document.getElementById(this.options.drop_target); if(drop_target) { - this.resumable.unAssignDrop(drop_target); + this.resumable.unAssignDrop([drop_target]); } }