Skip to content

Commit

Permalink
DefaultNode: When a child is removed from its parent, the child also …
Browse files Browse the repository at this point in the history
…clears its parent reference.
  • Loading branch information
moreApi committed Sep 13, 2021
1 parent be5a289 commit 795acc3
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/main/kotlin/graphics/scenery/DefaultNode.kt
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ open class DefaultNode(override var name: String = "Node") : Node {
this.getScene()?.sceneSize?.decrementAndGet()
GlobalScope.launch { this@DefaultNode.getScene()?.onChildrenRemoved?.forEach { it.value.invoke(this@DefaultNode, child) } }

return this.children.remove(child)
return this.children.remove(child).let { if (it) {child.parent = null}; it }
}

override fun removeChild(name: String): Boolean {
Expand Down

0 comments on commit 795acc3

Please sign in to comment.