gilzoide / unity-flex-ui

Flexbox layout support for Unity UI using the Yoga layout engine
The Unlicense
80 stars 5 forks source link

Crash when moving a FlexLayout object to another parent #10

Closed gilzoide closed 3 months ago

gilzoide commented 4 months ago

Discussed in https://github.com/gilzoide/unity-flex-ui/discussions/8

Originally posted by **mikitakuzmichkin** March 3, 2024 When you change the parent, Unity crashes. the case can be checked in the editor by dragging elements from one flex to another.
gilzoide commented 4 months ago

Crash error message:

libc++abi: terminating due to uncaught exception of type std::logic_error: Child already has a owner, it must be removed first.

Relevant stacktrace:

10 0x000002a50f5c78 in (wrapper managed-to-native) Gilzoide.FlexUi.Yoga.Yoga:YGNodeInsertChild (intptr,intptr,int) [{0x126a17d20} + 0xc0] (0x2a50f5bb8 0x2a50f5d00) [0x28a032a80 - Unity Child Domain]

11 0x000002a50f5b44 in Gilzoide.FlexUi.Yoga.YGNode:InsertChild (Gilzoide.FlexUi.Yoga.YGNode,int) [{0x126a16e58} + 0x74] [./Packages/com.gilzoide.flex-ui/Runtime/Yoga/YGNode.cs :: 266u] (0x2a50f5ad0 0x2a50f5b68) [0x28a032a80 - Unity Child Domain]

12 0x000002a50f52e4 in Gilzoide.FlexUi.FlexLayout:TrackChild (Gilzoide.FlexUi.FlexLayout,bool) [{0x2929d2560} + 0x1e4] [./Packages/com.gilzoide.flex-ui/Runtime/FlexLayout.cs :: 622u] (0x2a50f5100 0x2a50f5384) [0x28a032a80 - Unity Child Domain]

13 0x000002a50f40dc in Gilzoide.FlexUi.FlexLayout:RefreshParent () [{0x2929d24e8} + 0x1c4] [./Packages/com.gilzoide.flex-ui/Runtime/FlexLayout.cs :: 584u] (0x2a50f3f18 0x2a50f4180) [0x28a032a80 - Unity Child Domain]

14 0x00000319aa85a0 in Gilzoide.FlexUi.FlexLayout:OnTransformParentChanged () [{0x2929d23a8} + 0x78] [./Packages/com.gilzoide.flex-ui/Runtime/FlexLayout.cs :: 455u] (0x319aa8528 0x319aa85c8) [0x28a032a80 - Unity Child Domain]