widgets: trigger onRemove on private child widget to avoid memory leaks

This commit is contained in:
jean-emmanuel 2018-01-24 19:10:28 +01:00
parent b11f969929
commit 779fd4b8b1
12 changed files with 63 additions and 1 deletions

View file

@ -164,4 +164,9 @@ module.exports = class _canvas_base extends _widgets_base {
throw new Error('Calling unimplemented draw() method')
}
onRemove() {
this.off('resize')
super.onRemove()
}
}

View file

@ -201,4 +201,9 @@ module.exports = class Panel extends _widgets_base {
}
onRemove() {
this.off('resize')
super.onRemove()
}
}

View file

@ -175,4 +175,8 @@ module.exports = class Formula extends _widgets_base {
}
onRemove() {
this.input.onRemove()
super.onRemove()
}
}

View file

@ -247,4 +247,11 @@ module.exports = class MultiXy extends _pads_base {
}
onRemove() {
for (var i in this.pads) {
this.pads[i].onRemove()
}
super.onRemove()
}
}

View file

@ -198,4 +198,11 @@ module.exports = class Rgb extends _pads_base {
}
onRemove() {
this.hue.onRemove()
this.pad.onRemove()
if (this.input) this.input.onRemove()
super.onRemove()
}
}

View file

@ -262,4 +262,11 @@ module.exports = class Xy extends _pads_base {
}
onRemove() {
this.faders.x.onRemove()
this.faders.y.onRemove()
if (this.input) this.input.onRemove()
super.onRemove()
}
}

View file

@ -223,4 +223,9 @@ module.exports = class _sliders_base extends _canvas_base {
}
onRemove() {
if (this.input) this.input.onRemove()
super.onRemove()
}
}

View file

@ -259,4 +259,10 @@ module.exports = class Encoder extends _widgets_base {
}
onRemove() {
this.knob.onRemove()
this.display.onRemove()
super.onRemove()
}
}

View file

@ -91,7 +91,7 @@ module.exports = class Fader extends _sliders_base {
pips:false,
dashed:true
}
var meter = parser.parse([data],this.wrapper, this.parent)
var meter = parser.parse([data],this.wrapper, this)
meter.container.classList.add('not-editable')
this.widget.classList.add('has-meter')

View file

@ -433,4 +433,11 @@ module.exports = class Range extends _widgets_base {
}
onRemove() {
this.faders[0].onRemove()
this.faders[1].onRemove()
if (this.input) this.input.onRemove()
super.onRemove()
}
}

View file

@ -111,4 +111,9 @@ module.exports = class Crossfader extends Switcher {
}
onRemove() {
this.fader.onRemove()
super.onRemove()
}
}

View file

@ -79,5 +79,9 @@ module.exports = class Switcher extends _switchers_base {
}
onRemove() {
this.switch.onRemove()
super.onRemove()
}
}