widgets: prevent reCreateWidget from being called by a destroyed widget instace (#556)

This commit is contained in:
bordun 2019-09-04 15:44:19 +02:00
parent b49f1fb0ce
commit 34d740b2d9
3 changed files with 5 additions and 7 deletions

View file

@ -5,6 +5,7 @@
- bug fixes
- keys: prevent default browser actions when a combo is bound to a widget (for example print dialog with ctrl+p)
- xy: broken `doubleTap`
- widget: error when two sibling widgets have a non-dynamic property depending on each others and on another widget at the same time
## 0.47.3

View file

@ -21,8 +21,6 @@ var StateManager = class StateManager {
this.valueNewPropQueue = {}
this.queueCounter = 0
this.flushTimeout = null
}
get(filter) {
@ -233,10 +231,7 @@ var StateManager = class StateManager {
decrementQueue() {
this.queueCounter--
if (this.queueCounter == 0) {
if (this.flushTimeout) clearTimeout(this.flushTimeout)
this.flushTimeout = setTimeout(()=>{
this.flush()
})
this.flush()
}
}

View file

@ -147,6 +147,7 @@ class Widget extends EventEmitter {
this.hash = nanoid('abcdefghijklmnopqrstuvwxyABCDEFGHIJKLMNOPQRSTUVWXYZ', 10)
this.children = []
this.reCreateOptions = options.reCreateOptions
this.removed = false
this.createPropsCache()
@ -924,12 +925,13 @@ class Widget extends EventEmitter {
reCreateWidget(options={}){
return updateWidget(this, options)
if (!this.removed) return updateWidget(this, options)
}
onRemove(){
this.removed = true
widgetManager.off(undefined, undefined, this)
this.removeOscReceivers()