clone: prevent freeze and print an error when attempting to create a circular clone
This commit is contained in:
parent
3f7c30df95
commit
06f2c1b0c8
2 changed files with 10 additions and 0 deletions
|
|
@ -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
|
||||
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue