Skip to content

Commit

Permalink
Merge pull request #442 from scenerygraphics/fix-child-removal
Browse files Browse the repository at this point in the history
Fix childrens keeping reference of their removed parents. Thanks @moreApi 👍
  • Loading branch information
skalarproduktraum authored Oct 20, 2021
2 parents 2cc5a5a + 795acc3 commit f6aedc1
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 f6aedc1

Please sign in to comment.