clone: prevent freeze and print an error when attempting to create a circular clone

This commit is contained in:
jean-emmanuel 2022-02-08 18:35:45 +01:00
parent 3f7c30df95
commit 06f2c1b0c8
2 changed files with 10 additions and 0 deletions

View file

@ -4,6 +4,7 @@
- bug fixes
- inspector: script editor: cursor alignment issue in indented lines
- clone: prevent freeze and print an error when attempting to create a circular clone
## 1.14.5

View file

@ -53,6 +53,15 @@ class Clone extends Container() {
this.container.classList.add('empty')
var parent = this.parent
while (parent !== widgetManager) {
if (parent.getProp('id') === this.getProp('widgetId')) {
this.errorProp('widgetId', 'circular reference', 'cannot create clone: target widget is a parent of this clone.')
return
}
parent = parent.parent
}
this.bindTarget(this.getCloneTarget())
if (this.cloneTarget) this.createClone(true)