Fix children being unparented after moving to another parent (#102)

Co-authored-by: centau <83140718+centau@users.noreply.github.com>
This commit is contained in:
Kaan 2026-10-22 14:38:05 +03:00 • committed by GitHub
parent c2bd2c2d4c
commit a75e3ee843
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 30 additions and 3 deletions

View file

@ -1109,6 +1109,33 @@ TEST("create()", wrap_root(function()
CHECK(parent:FindFirstChild "c")
end
do CASE "children moved to another parent"
local other = create "Frame" {}
local child = create "Frame" {}
local children_a = source { child }
local children_b = source {}
create "Frame" { children_a }
local parent_b = create "Frame" { children_b }
children_b { child }
children_a {}
CHECK(child.Parent == parent_b)
local a = create "Frame" {}
local b = create "Frame" {}
local destroy = root(function()
create "Frame" { function() return a end }
create "Frame" { function() return { function() return b end } end }
end)
a.Parent = other
b.Parent = other
destroy()
CHECK(a.Parent == other)
CHECK(b.Parent == other)
end
do CASE "garbage collection test"
local wref